Skip to main content
replaced http://drupal.stackexchange.com/ with https://drupal.stackexchange.com/
Source Link

For an experimental Drupal 7 site, I would like attach a single node to another entity (this might be users, other nodes or even organic groups). The reasoning is fairly simple, say I have several users active and they can gain badges for activity just like in any stackexchange platform. Each badge is represented by a single node. Now, how could a user get the same badge multiple times?

Using entityreference, I can attach the same reference multiple times, but I am struggling with the output, it will show the same badge multiple times instead of only badge name and a counter. Is there already a module for that I haven't found yet? Can you think of a better way to do it?

Badges might not be the best example as you normally wouldn't lose any. Think of a trading card game might be better, as you can have the same card multiple times and trade it with another user. So, in the end I would need a way to add and remove the references. But this will be custom code, I guess.

EDIT (in answer to WebdripsWebdrips' comment): As said in the very beginning, it's just an experiment so far, we are trying to use Drupal in unconventional ways in order to explore the full capacity of Drupal as a framework.

So, I came up with a better example to illustrate what I would like to achieve: let's say I am building a browser game. Game users will be normal Drupal user entities. An user may have several normal fields like health (number), name (text) and gender (list). Additionally, this user can collect items where each individual item type can be found multiple times.

Several players can be in a clan (organic group). This group has a central storage. So, each individual player of that group can place an item in the central storage.

Technically, I need a relation between user and item (for each item type) which also holds the number of items (e.g. Player1 has 5 nails). If he places 2 nails in the central storage, I need to change the relation between user and item (e.g. Player1 now has 3 nails) as well as the relation between organic group and item (e.g. Group1 has 2 nails).

So I am actually looking for a way to connect an item node (e.g. nails) to other entities (users, organic groups, ...) along with an additional value (item count).

I hope this renders my problem/question in an easier-to-understand way.

I've come across the User Points module and for keeping track of game points in my example this might be the right way to go, but imho it's not suited for the item thing.

For an experimental Drupal 7 site, I would like attach a single node to another entity (this might be users, other nodes or even organic groups). The reasoning is fairly simple, say I have several users active and they can gain badges for activity just like in any stackexchange platform. Each badge is represented by a single node. Now, how could a user get the same badge multiple times?

Using entityreference, I can attach the same reference multiple times, but I am struggling with the output, it will show the same badge multiple times instead of only badge name and a counter. Is there already a module for that I haven't found yet? Can you think of a better way to do it?

Badges might not be the best example as you normally wouldn't lose any. Think of a trading card game might be better, as you can have the same card multiple times and trade it with another user. So, in the end I would need a way to add and remove the references. But this will be custom code, I guess.

EDIT (in answer to Webdrips' comment): As said in the very beginning, it's just an experiment so far, we are trying to use Drupal in unconventional ways in order to explore the full capacity of Drupal as a framework.

So, I came up with a better example to illustrate what I would like to achieve: let's say I am building a browser game. Game users will be normal Drupal user entities. An user may have several normal fields like health (number), name (text) and gender (list). Additionally, this user can collect items where each individual item type can be found multiple times.

Several players can be in a clan (organic group). This group has a central storage. So, each individual player of that group can place an item in the central storage.

Technically, I need a relation between user and item (for each item type) which also holds the number of items (e.g. Player1 has 5 nails). If he places 2 nails in the central storage, I need to change the relation between user and item (e.g. Player1 now has 3 nails) as well as the relation between organic group and item (e.g. Group1 has 2 nails).

So I am actually looking for a way to connect an item node (e.g. nails) to other entities (users, organic groups, ...) along with an additional value (item count).

I hope this renders my problem/question in an easier-to-understand way.

I've come across the User Points module and for keeping track of game points in my example this might be the right way to go, but imho it's not suited for the item thing.

For an experimental Drupal 7 site, I would like attach a single node to another entity (this might be users, other nodes or even organic groups). The reasoning is fairly simple, say I have several users active and they can gain badges for activity just like in any stackexchange platform. Each badge is represented by a single node. Now, how could a user get the same badge multiple times?

Using entityreference, I can attach the same reference multiple times, but I am struggling with the output, it will show the same badge multiple times instead of only badge name and a counter. Is there already a module for that I haven't found yet? Can you think of a better way to do it?

Badges might not be the best example as you normally wouldn't lose any. Think of a trading card game might be better, as you can have the same card multiple times and trade it with another user. So, in the end I would need a way to add and remove the references. But this will be custom code, I guess.

EDIT (in answer to Webdrips' comment): As said in the very beginning, it's just an experiment so far, we are trying to use Drupal in unconventional ways in order to explore the full capacity of Drupal as a framework.

So, I came up with a better example to illustrate what I would like to achieve: let's say I am building a browser game. Game users will be normal Drupal user entities. An user may have several normal fields like health (number), name (text) and gender (list). Additionally, this user can collect items where each individual item type can be found multiple times.

Several players can be in a clan (organic group). This group has a central storage. So, each individual player of that group can place an item in the central storage.

Technically, I need a relation between user and item (for each item type) which also holds the number of items (e.g. Player1 has 5 nails). If he places 2 nails in the central storage, I need to change the relation between user and item (e.g. Player1 now has 3 nails) as well as the relation between organic group and item (e.g. Group1 has 2 nails).

So I am actually looking for a way to connect an item node (e.g. nails) to other entities (users, organic groups, ...) along with an additional value (item count).

I hope this renders my problem/question in an easier-to-understand way.

I've come across the User Points module and for keeping track of game points in my example this might be the right way to go, but imho it's not suited for the item thing.

Remove tag from title and add module link
Source Link
Pierre.Vriens
  • 36k
  • 40
  • 50
  • 182

D7: How to attach a single node multiple times to an entity (e.g. badges)?

For an experimental Drupal 7 site, I would like attach a single node to another entity (this might be users, other nodes or even organic groups). The reasoning is fairly simple, say I have several users active and they can gain badges for activity just like in any stackexchange platform. Each badge is represented by a single node. Now, how could a user get the same badge multiple times?

Using entityreference, I can attach the same reference multiple times, but I am struggling with the output, it will show the same badge multiple times instead of only badge name and a counter. Is there already a module for that I haven't found yet? Can you think of a better way to do it?

Badges might not be the best example as you normally wouldn't lose any. Think of a trading card game might be better, as you can have the same card multiple times and trade it with another user. So, in the end I would need a way to add and remove the references. But this will be custom code, I guess.

EDIT (in answer to Webdrips' comment): As said in the very beginning, it's just an experiment so far, we are trying to use Drupal in unconventional ways in order to explore the full capacity of Drupal as a framework.

So, I came up with a better example to illustrate what I would like to achieve: let's say I am building a browser game. Game users will be normal Drupal user entities. An user may have several normal fields like health (number), name (text) and gender (list). Additionally, this user can collect items where each individual item type can be found multiple times.

Several players can be in a clan (organic group). This group has a central storage. So, each individual player of that group can place an item in the central storage.

Technically, I need a relation between user and item (for each item type) which also holds the number of items (e.g. Player1 has 5 nails). If he places 2 nails in the central storage, I need to change the relation between user and item (e.g. Player1 now has 3 nails) as well as the relation between organic group and item (e.g. Group1 has 2 nails).

So I am actually looking for a way to connect an item node (e.g. nails) to other entities (users, organic groups, ...) along with an additional value (item count).

I hope this renders my problem/question in an easier-to-understand way.

I've come across userpointsthe User Points module and for keeping track of game points in my example this might be the right way to go, but imho it's not suited for the item thing.

D7: How to attach a single node multiple times to an entity (e.g. badges)?

For an experimental Drupal 7 site, I would like attach a single node to another entity (this might be users, other nodes or even organic groups). The reasoning is fairly simple, say I have several users active and they can gain badges for activity just like in any stackexchange platform. Each badge is represented by a single node. Now, how could a user get the same badge multiple times?

Using entityreference, I can attach the same reference multiple times, but I am struggling with the output, it will show the same badge multiple times instead of only badge name and a counter. Is there already a module for that I haven't found yet? Can you think of a better way to do it?

Badges might not be the best example as you normally wouldn't lose any. Think of a trading card game might be better, as you can have the same card multiple times and trade it with another user. So, in the end I would need a way to add and remove the references. But this will be custom code, I guess.

EDIT (in answer to Webdrips' comment): As said in the very beginning, it's just an experiment so far, we are trying to use Drupal in unconventional ways in order to explore the full capacity of Drupal as a framework.

So, I came up with a better example to illustrate what I would like to achieve: let's say I am building a browser game. Game users will be normal Drupal user entities. An user may have several normal fields like health (number), name (text) and gender (list). Additionally, this user can collect items where each individual item type can be found multiple times.

Several players can be in a clan (organic group). This group has a central storage. So, each individual player of that group can place an item in the central storage.

Technically, I need a relation between user and item (for each item type) which also holds the number of items (e.g. Player1 has 5 nails). If he places 2 nails in the central storage, I need to change the relation between user and item (e.g. Player1 now has 3 nails) as well as the relation between organic group and item (e.g. Group1 has 2 nails).

So I am actually looking for a way to connect an item node (e.g. nails) to other entities (users, organic groups, ...) along with an additional value (item count).

I hope this renders my problem/question in an easier-to-understand way.

I've come across userpoints module and for keeping track of game points in my example this might be the right way to go, but imho it's not suited for the item thing.

How to attach a single node multiple times to an entity (e.g. badges)?

For an experimental Drupal 7 site, I would like attach a single node to another entity (this might be users, other nodes or even organic groups). The reasoning is fairly simple, say I have several users active and they can gain badges for activity just like in any stackexchange platform. Each badge is represented by a single node. Now, how could a user get the same badge multiple times?

Using entityreference, I can attach the same reference multiple times, but I am struggling with the output, it will show the same badge multiple times instead of only badge name and a counter. Is there already a module for that I haven't found yet? Can you think of a better way to do it?

Badges might not be the best example as you normally wouldn't lose any. Think of a trading card game might be better, as you can have the same card multiple times and trade it with another user. So, in the end I would need a way to add and remove the references. But this will be custom code, I guess.

EDIT (in answer to Webdrips' comment): As said in the very beginning, it's just an experiment so far, we are trying to use Drupal in unconventional ways in order to explore the full capacity of Drupal as a framework.

So, I came up with a better example to illustrate what I would like to achieve: let's say I am building a browser game. Game users will be normal Drupal user entities. An user may have several normal fields like health (number), name (text) and gender (list). Additionally, this user can collect items where each individual item type can be found multiple times.

Several players can be in a clan (organic group). This group has a central storage. So, each individual player of that group can place an item in the central storage.

Technically, I need a relation between user and item (for each item type) which also holds the number of items (e.g. Player1 has 5 nails). If he places 2 nails in the central storage, I need to change the relation between user and item (e.g. Player1 now has 3 nails) as well as the relation between organic group and item (e.g. Group1 has 2 nails).

So I am actually looking for a way to connect an item node (e.g. nails) to other entities (users, organic groups, ...) along with an additional value (item count).

I hope this renders my problem/question in an easier-to-understand way.

I've come across the User Points module and for keeping track of game points in my example this might be the right way to go, but imho it's not suited for the item thing.

Tweeted twitter.com/#!/StackDrupal/status/521875346044764160
added 1424 characters in body
Source Link
Paul
  • 1.2k
  • 12
  • 23

For an experimental Drupal 7 site, I would like attach a single node to another entity (this might be users, other nodes or even organic groups). The reasoning is fairly simple, say I have several users active and they can gain badges for activity just like in any stackexchange platform. Each badge is represented by a single node. Now, how could a user get the same badge multiple times?

Using entityreference, I can attach the same reference multiple times, but I am struggling with the output, it will show the same badge multiple times instead of only badge name and a counter. Is there already a module for that I haven't found yet? Can you think of a better way to do it?

Badges might not be the best example as you normally wouldn't lose any. Think of a trading card game might be better, as you can have the same card multiple times and trade it with another user. So, in the end I would need a way to add and remove the references. But this will be custom code, I guess.

EDIT (in answer to Webdrips' comment): As said in the very beginning, it's just an experiment so far, we are trying to use Drupal in unconventional ways in order to explore the full capacity of Drupal as a framework.

So, I came up with a better example to illustrate what I would like to achieve: let's say I am building a browser game. Game users will be normal Drupal user entities. An user may have several normal fields like health (number), name (text) and gender (list). Additionally, this user can collect items where each individual item type can be found multiple times.

Several players can be in a clan (organic group). This group has a central storage. So, each individual player of that group can place an item in the central storage.

Technically, I need a relation between user and item (for each item type) which also holds the number of items (e.g. Player1 has 5 nails). If he places 2 nails in the central storage, I need to change the relation between user and item (e.g. Player1 now has 3 nails) as well as the relation between organic group and item (e.g. Group1 has 2 nails).

So I am actually looking for a way to connect an item node (e.g. nails) to other entities (users, organic groups, ...) along with an additional value (item count).

I hope this renders my problem/question in an easier-to-understand way.

I've come across userpoints module and for keeping track of game points in my example this might be the right way to go, but imho it's not suited for the item thing.

For an experimental Drupal 7 site, I would like attach a single node to another entity (this might be users, other nodes or even organic groups). The reasoning is fairly simple, say I have several users active and they can gain badges for activity just like in any stackexchange platform. Each badge is represented by a single node. Now, how could a user get the same badge multiple times?

Using entityreference, I can attach the same reference multiple times, but I am struggling with the output, it will show the same badge multiple times instead of only badge name and a counter. Is there already a module for that I haven't found yet? Can you think of a better way to do it?

Badges might not be the best example as you normally wouldn't lose any. Think of a trading card game might be better, as you can have the same card multiple times and trade it with another user. So, in the end I would need a way to add and remove the references. But this will be custom code, I guess.

For an experimental Drupal 7 site, I would like attach a single node to another entity (this might be users, other nodes or even organic groups). The reasoning is fairly simple, say I have several users active and they can gain badges for activity just like in any stackexchange platform. Each badge is represented by a single node. Now, how could a user get the same badge multiple times?

Using entityreference, I can attach the same reference multiple times, but I am struggling with the output, it will show the same badge multiple times instead of only badge name and a counter. Is there already a module for that I haven't found yet? Can you think of a better way to do it?

Badges might not be the best example as you normally wouldn't lose any. Think of a trading card game might be better, as you can have the same card multiple times and trade it with another user. So, in the end I would need a way to add and remove the references. But this will be custom code, I guess.

EDIT (in answer to Webdrips' comment): As said in the very beginning, it's just an experiment so far, we are trying to use Drupal in unconventional ways in order to explore the full capacity of Drupal as a framework.

So, I came up with a better example to illustrate what I would like to achieve: let's say I am building a browser game. Game users will be normal Drupal user entities. An user may have several normal fields like health (number), name (text) and gender (list). Additionally, this user can collect items where each individual item type can be found multiple times.

Several players can be in a clan (organic group). This group has a central storage. So, each individual player of that group can place an item in the central storage.

Technically, I need a relation between user and item (for each item type) which also holds the number of items (e.g. Player1 has 5 nails). If he places 2 nails in the central storage, I need to change the relation between user and item (e.g. Player1 now has 3 nails) as well as the relation between organic group and item (e.g. Group1 has 2 nails).

So I am actually looking for a way to connect an item node (e.g. nails) to other entities (users, organic groups, ...) along with an additional value (item count).

I hope this renders my problem/question in an easier-to-understand way.

I've come across userpoints module and for keeping track of game points in my example this might be the right way to go, but imho it's not suited for the item thing.

Source Link
Paul
  • 1.2k
  • 12
  • 23
Loading