AnsPress 2.0 – User Profile -> pull request

6.05K viewsCore
1

Hi,

I figured out how to add a custom tab to the user-profile.
I love the extension-pattern that you applied! Thanks!

One issue I found was that the tab-page which I registered with
ap_register_user_page('testtab', __('Test tab', 'ap'), array('AnsPress_User_Page_Test', 'output'));
came first in the menu list. Probably because I called the ap_register_user_page too early.

Anyway, it started me thinking that things might get nasty when multiple plugins want to add a tab -> in which order will they be added?
So I have made some changes to the anspress-master\includes\user.php file in such way that you can now specify an order when registering a tab:
ap_register_user_page('testtab', __('Test tab', 'ap'), 90, array('AnsPress_User_Page_Test', 'output'));

If you agree to it, you can find the changes here: https://www.dropbox.com/s/l2mu2mtfv1kiwwa/user.php?dl=0
I have all the changed sections marked with the //MVRM comment, so you can easily find my changes.

Greetings,

Michiel

1

Michiel, Yeh its a good idea. But do not post your code in box.com instead fork our Github anspress and then send pull request.

Hi Rahul what about login could you fix ?

will check your issues today.

Ok, I will look in how to do that. Never created a pull request before 🙂

Rahul, should I create a GitHub pull request for this change too? Or will you use the file in dropbox for this one time?

Hi Rahul, I saw your commit on GitHub titled “Added sorting in user menu”, but after downloading the latest version my menu isn’t sorted anymore. Should I set the sorting in another way (not as 3th param of ap_register_user_page)? Thanks

You are viewing 1 out of 3 answers, click here to view all answers.