how to use elgg_set_page_owner_guid() and elgg_get_page_owner_guid()

Hi everybody,

I've been working on customising the profile plugin and can't seem to make those functions work.

Basically I set up an extra area to the profile that declares a menu linked to several "sections" and "subsections".

here is how things are organized right now:

Each section is within a separate plugin and adds its own ElggMenuItem to the section menu as well as the subsection menu during plugin initialisation.

mysite/profile/username links to the user profile, my plugin uses a page handler where elgg_set_page_owner_guid() is called.

the same page handler accepts url formatted as : mysite/profile/username/section/subsection

and add relevant section and subsection to the profile page by calling  elgg_view().

I need to retrieve the owner of the profile to customize  the views (edit buttons, retrieve entities from the database etc...)

I tried to get this with elgg_get_page_owner_guid() but it keeps returning 0.

I managed to make it work by parsing the current_url() but it feels hacky to me, is there a better way to accomplish this? or to make elgg_get_page_owner_guid() work?

I come from software development and I might be missing something pretty basic, I hope someone can help me here.

  •  For your elgg_get_page_owner_guid() handdler to work you have to force it to return 1 by writting it like this... otherwise, it will always return 0 or kick the user out or load logout contents to a logged in user

    <?php

    elgg_get_page_owner_guid(1);

    ?>

    hope this will help.

    Tom

Beginning Developers

Beginning Developers

This space is for newcomers, who wish to build a new plugin or to customize an existing one to their liking