?
Solved

aMember page title

Posted on 2014-02-27
1
Medium Priority
?
446 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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 Off-Site Backups Are The Only Way To Go

You are probably backing up your data—but how and where? Ransomware is on the rise and there are variants that specifically target backups. Read on to discover why off-site is the way to go.

Question has a verified solution.

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

This article shows the steps required to install WordPress on Azure. Web Apps, Mobile Apps, API Apps, or Functions, in Azure all these run in an App Service plan. WordPress is no exception and requires an App Service Plan and Database to install
The SignAloud Glove is capable of translating American Sign Language signs into text and audio.
The viewer will learn how to count occurrences of each item in an array.
Simple Linear Regression
Suggested Courses

800 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