I create an input form like below:
Data for 2010-03:
Name | sell | pv | month
John | 300 |20 | 2010-03
Simon| 500 |60 | 2010-03
Data for 2010-02:
Name | sell | pv | month
John | 100 |10 | 2010-02
Simon| 200 |20 | 2010-02
the above two example only one will show, it changes when the month dropdown selection changes. The name are read from objects-enity, so I also get its guid. I use create_metadata_from_array() to insert the data. and it does.
but now I have no idea how to read them out by a specified month, for example, I want to get the data of month "2010-03". Which function can do this?
Thank you very much!
info@elgg.org
Security issues should be reported to security@elgg.org!
©2014 the Elgg Foundation
Elgg is a registered trademark of Thematic Networks.
Cover image by RaĆ¼l Utrera is used under Creative Commons license.
Icons by Flaticon and FontAwesome.
Under Elgg 1.7, that would be:
@Kevin, this function returns the object's infomation only,
Metadata doesn't show up in a var_dump() of the entity. It uses the __get() magic method to supply it when accessed. Once you have that entity say
Also, how are you saving this? Whatever name you use to save the metadata is the name you have to use to retrieve it.
Hello
I have been trying to figure out how to pull information stored on a users page as well, to use with another plugin.
For instance using a plugin like profile manager where the user would input a custom profile type then list information such as which state they are from.
I know the guid #s are 3 & 6 for the two profile types and the metadate names are p_type & b_type.
What would be the best way to get this information into another plugin?
If you know the entity guids and the metadata names, all you have to do is say:
There's pretty decent documentation for this on the docs page: http://docs.elgg.org/wiki/Engine/DataModel/Metadata
So the line
$entity = get_entity($guid);
declares the page owners guid # ?
Right?
the enity guid #
sorry to seem so dense here...
ok I got to thinking profile manager saves the profile types as custom_profile_type and I am using 1.7
so if I say:
$entity = elgg_get_entities_from_metadata($custom_profile_type);
echo $entity;
it does retrun ARRAY
yet the var_dump statement still returns NULL, NULL
and an If statement of $entity == 3 returns False????
I amy trying to find out if the user has declared his profile type is type = "p_type" or if he is using the profile type = "b_type"
You have to define $custom_profile_type before you can use it in that call. In this case it needs to be an array as described in the elgg_get_entities_from_metadata() documentation.
$entity won't == 3 at this point because it's an array of ElggEntity objects or FALSE. If you var_dump($entity) after that call you'll probably see a list of 10 entities, but none of them will be what you want because $custom_profile_type isn't defined :-X
$entity = get_entity(3) will return the entity with GUID 3. I don't think this is what you want either because it looks like 3 is the metadata ID of p_type (maybe)...
- Previous
- 1
- 2
- Next
You must log in to post replies.