Solved

aMember page title

Posted on 2014-02-27
1
429 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

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

Whether you've completed a degree in computer sciences or you're a self-taught programmer, writing your first lines of code in the real world is always a challenge. Here are some of the most common pitfalls for new programmers.
In order to have all security and back ups taken care of, WordPress users can sign up for services with WP Engine.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…

747 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

10 Experts available now in Live!

Get 1:1 Help Now