Notifications
Clear all

wpForo 1.x.x [Closed] Adding Items to Profile Menu

5 Posts
3 Users
0 Likes
2,596 Views
Posts: 5
Topic starter
(@avatarati)
Active Member
Joined: 7 years ago

Hello,

I've been tinkering with the files trying to get some extra pages added to the profile section. So far, I've figured out how to add in links to the menu beyond just 'account,' 'activity', and 'subscriptions.' There are three spots which I modified in the class-template.php file:

 

	public function init_member_templates(){
		$this->wpforo->member_tpls = array(
			'account' => wpftpl('profile-account.php'),
			'characters' => wpftpl('profile-characters.php'),//ADDED THIS LINE PLUS THE RELEVANT PHP FILE 
			'activity' => wpftpl('profile-activity.php'),
			'subscriptions' => wpftpl('profile-subscriptions.php'),
		);
		$this->wpforo->member_tpls = apply_filters('wpforo_member_templates_filter', $this->wpforo->member_tpls);
		$this->wpforo->member_tpls['profile'] = wpftpl('profile-home.php');
	}

Under function init_nav_menu()...

$this->wpforo->menu['wpforo-profile-characters'] = array(
			'href' => $this->wpforo->member->get_profile_url($this->wpforo->current_userid, 'characters'),
			'label' => wpforo_phrase('characters', FALSE),
			'attr' => ( $template == 'characters' ? ' class="wpforo-active"' : '' ),
			'submenues' => array()
		);

And finally...

public function member_menu( $userid, $menu = array() ){ 
		if( empty($menu) ) $menu = array('profile' => 'fa-user', 'characters' => 'fa-user', 'account' => 'fa-cog', 'activity' => 'fa-comments-o', 'subscriptions');

As mentioned in a comment above, I did add a profile-characters.php file in the following location: \wpforo\wpf-themes\classic

However, when I click on the link in the menu, it comes up as a 404 error. The URL is built correctly and points me to the right place. I'm assuming that public function init_member_templates() tells wpforo which php file to load under the current template.

I figure I must be missing another modification I need to make. Could anyone point me in the right direction, please?

Thanks!

4 Replies
Posts: 5
Topic starter
(@avatarati)
Active Member
Joined: 7 years ago

One more observation:

When I click on the link for 'Characters' under my profile, it takes me to a 404 page, the URL is built correctly, but the breadcrumbs do not get built correctly. Instead, of being:

Home > Members > My Member > Characters

it is the first forum category followed by a blank section, so the breadcrumb becomes:

Home > First Forum Cateogry > (blank, no text) > (blank, no text)

Robert
Posts: 10503
Admin
(@robert)
Support Team
Joined: 8 years ago

Hi avatarati,

thank you for sharing this code. I'm really sorry but we don't support custom code and our time is very limited to be able check the issues and provide with such code correction. wpForo permalink system is not extendable yet so you may get such problem.

Posts: 5
Topic starter
(@avatarati)
Active Member
Joined: 7 years ago

No worries, Robert. Thank you for your reply.

I was able to figure it out. Got new buttons added to my profile menus and am able to execute PHP code on those new tabs if the user owns that profile. Custom buttons are disabled to members who do not own the profile. 

Also added functionality to list every new topic that has been posted since the user's last login.

Been busy!

 

1 Reply
(@falconcoin)
Joined: 7 years ago

New Member
Posts: 3

could you post how you got this to work?   im swapping out ultimate member and want to be able to add a few items to the profile as well