Solved

aMember page title

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

Creating Instructional Tutorials  

For Any Use & On Any Platform

Contextual Guidance at the moment of need helps your employees/users adopt software o& achieve even the most complex tasks instantly. Boost knowledge retention, software adoption & employee engagement with easy solution.

Question has a verified solution.

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

Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
This article discusses four methods for overlaying images in a container on a web page
The purpose of this video is to demonstrate how to set up basic WordPress SEO. This will be demonstrated using a Windows 8 PC. The plugin used will be WordPress SEO by Yoast. Go to your WordPress login page. This will look like the following: myw…
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …

729 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