tags:

views:

66

answers:

2

I have created a new plugin named 'adv' in my elgg site.

And in this plugin iam listing the users.Which using the view from other elgg plugin 'profile

ie the page profile/views/default/profile/listing.php.

Now i need to set a link in the existing view of each user.So i have to edit the profile plugin , mainly the page profile/views/default/profile/listing.php

But how can i do this, without modifying elggs default plugin 'profile'.

I have tried a method that i have copied the folder 'profile' from profile/views/default/profile and put it in adv/views/default/.But it donot working.]

Is any solution for adding new link to the user view with editing other plugin, only editing our own plugin example 'adv'.

+1  A: 

Please check if "Use view filepath cache (recommended)", is disabled in the site administration. Because elgg uses hard view cache. Or delete the view_cache file from the data directory. And also make user your plugin is below the "Profile" in the plugin list.

Chetan sharma
Guys Please tell me what should i do of this answer (as i am new new to stackoverflow), should i delete it, as it seems there is no more activity on this question, and it is the only answer (and it is even not accepted).
Chetan sharma
A: 

You'll need to override the profile/listing view, but only when Elgg is rendering your plugin's pages, not to interfere with other plugins that might want to use the core profile/listing view.

My approach to this problem is the following:

  1. Create a new directory that will hold the views that you want to override. In your case, I'd create the "adv/views/mod" directory within your_site_root/mod.

  2. Add the view you'd like to override into this directory. Again, your case, copy the profile/views/default/profile/listing.php to the following location: adv/views/mod/default/profile/listing.php

  3. Make your modifications to the newly created view. You can now safely modify the adv/views/mod/default/profile/listing.php file to your liking

  4. Tell Elgg to use the special view when your plugin is rendering the page. This means you'll have to call the set_view_location(..) method either from your page_handler function, or the php files that are referenced by your page_handler and usually prepare the data for the views (like index.php or read.php, but I don't know your plugin's file hierarchy) So in your case you'd call set_view_location('profile/listing', $CONFIG->pluginspath . 'adv/views/mod/'); either from your page_handler or from one of the above files. Make sure that $CONFIG is present and available by referencing it (global $CONFIG).

András Szepesházi