Change the items in the drop-down menu

7.46K viewsThemes
0

Hi everyone,

I was wondering how can I change the items in the dropdown menu? I would like to remove some sections that I’m not using.
I searched a lot and I didn’t find anything which might help me to fix my issue.

Could someone tell me which file I need to edit?

Thank you,

Audran 🙂

PS:  I’m actually using Askbug

AnsPress 4.0 or 3.x?

3.0.7 🙂

up please

Please tell me which items you want to remove or modify. I will show the exact code for that purpose

0

Hello,

Sorry for late replay. here is an example:

function my_ap_user_menu( $menus ) {
	// var_dump( $menus ); // This will show all menu items.

	if ( isset( $menus['notifications'] )) {
		unset( $menus['notifications'] );
	}
}
add_filter( 'ap_user_menu', 'my_ap_user_menu' );

This above code will remove notifications item from user menu.

edited comment on answer

Hi man ! Thank you so muck for answering, but when we past it into the ‘function.php’ file, it delets all the items. Not only ‘notifications’. Is there anything to do about that ?

And it delets all the items even with :

function my_ap_user_menu( $menus ) {
var_dump( $menus );
}
add_filter( ‘ap_user_menu’, ‘my_ap_user_menu’ );

So i don’t understand … Have you got any idea what should i do ?

Please read the basics of WordPress filter in wp.org. You must return in filter callback.

So I apply ‘my_ap_user_menu’ to ‘ap_user_menu’ by adding :
add_filter( ‘ap_user_menu’, ‘my_ap_user_menu’ );
In ‘hooks.php’ ?
And then i add the function
‘my_ap_user_menu’ in ‘functions.php’ ?

0

Hello Rahul Aryan,

I got the same issue, but I have to admit that I don’t understand how does “apply_filters()” works, and then, how to edit the dropdown menu.

If the dropdown menu “Extract menu from registered user pages” do I have to delet the pages I don’t need ?

Thank you for spending time to answer us 🙂

Wallpou (Anspress 3.0.7 + askbug theme)

commented on answer

Please tell me which items you want to remove or modify. I will show the exact code for that purpose

We are on the same team so we need to remove: Notification, Reputation, Question, Answer, Followers and Following

Thank you so much for your help

up please 🙂

Can you please stop this “UP” thing ? Not polite and confusing for all of us.

I agree this is not polite but we really need to remove a those items. :/ More over the ticket is now open for 10 days and our issue is becoming urgent :s

I agree with TheWallpou, if someone can help us ! We are in the team so one answer will be enough !

ok, guys then everybody should fill this forum-like support system with UPs.

Good luck.

0

Hello,

Please use this filter:

https://github.com/anspress/anspress/blob/3.0.7/includes/user.php#L284

commented on answer

Okey thank you but I don’t understand how to change it actually 🙁

Can you explain what is the role of a filter and what should I do?

Thanks a lot