Solved

aMember page title

Posted on 2014-02-27
1
430 Views
Last Modified: 2014-02-28
I've submitted a support ticket at aMember for this, but it's taking too long to get resolved. They don't seem to understand what we need so I'm hoping someone here is familiar with aMember and might be able to help quicker.

Our aMember installation is using the wordpress plugin so that it uses the wordpress theme. So I have to use the wp_title hook in the amember site.php file that's used for custom funcitons to work with the page title. The problem I'm having is that we want the member's custom profile field of company name to show in the page title according to the member profile being viewed by anyone. This way when the search engines list the pages, they will have the site and the company name showing.

This is the code that actually hooks and alters the page title - which does work, BUT it ONLY shows the company name of the user logged in and only when logged in. What we need is the company name to show regardless of being logged in and the company name of the profile being viewed.

//for page titles
function amember_wp_title( $title, $sep ) {
	global $paged, $page;
	if($user = Am_Di::getInstance()->auth->getUser())
	     $cname = $user->company_name; 
	$title = get_bloginfo( 'name' ).' | Member | '. @$cname;
	return $title;
}
Am_Di::getInstance()->hook->add(Am_Event::GLOBAL_INCLUDES_FINISHED, 'myglobalIncludesFinished');
function myglobalIncludesFinished()
{
add_action("wp_head", 'wpHeadHook');
add_filter( 'wp_title', 'amember_wp_title', 20, 2 );
}

Open in new window


Here's some pages to view to get a better understanding of what I mean:

This page should add Search Commander, Inc. to the title:
http://www.sempdx.org/amember/directory/index/666363524144

This page should add Thomas Creek Concepts:
http://www.sempdx.org/amember/directory/index/414e46633634

Any help would be great. Even if there's other suggestions besides the amember's code calls might be worth trying.
0
Comment
Question by:Dzynit
1 Comment
 
LVL 14

Accepted Solution

by:
Dzynit earned 0 total points
ID: 39895130
I thought it might be difficult to get an answer on this since I didn't find many amember questioned asked here.
Support finally got the right code combo, so it's now working. For anyone that might search for help with this:

    $request = Zend_Controller_Front::getInstance()->getRequest();
    if($request->getModuleName() == 'directory' && $request->getParam('user_id')){
        $rec = new DirectoryRecord(Am_Di::getInstance()->directoryTable);
        $user_id = $rec->decodeUserId($request->getParam('user_id'));
        $user  = Am_Di::getInstance()->userTable->load($user_id);
// $user - is Object of user which profile is  being displayed at the moment. 

    }

Open in new window

0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Entering a date in Microsoft Access can be tricky. A typo can cause month and day to be shuffled, entering the day only causes an error, as does entering, say, day 31 in June. This article shows how an inputmask supported by code can help the user a…
This is about my first experience with programming Arduino.
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …
The is a quite short video tutorial. In this video, I'm going to show you how to create self-host WordPress blog with free hosting service.

867 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now