Dear Michelle,

I am trying to put contact link for user's contact form under the user picture (instead of having the contact tab) - I find it more user friendly...

I am trying to add this with "New custom content" in minipanel "All about user", where I put link into the body and then put this panel under the picture panel on the left.

I have tried different approaches to the contact link, but none of them works.

Here is a pretty simple try, but generated link is missing user ID and it ends like this "url/user/contact" instead of "url/user/2/contact".

Here is the code that doesnt work: <a href="./contact">Contact me</a>

Can you please suggest what to put inside the link to have user ID there?
Thank you very much :0

Comments

michelle’s picture

Status: Active » Fixed

The contact link is already in the "user info" pane. If you need it by itself someplace else, you can add another copy of the user info content type to the panel and use theming to control which of the fields get displayed where. You can also use arg(1) in a custom content type (thru the UI) to get the uid.

I can't help you with removing the existing tab.

Michelle

Richard_’s picture

Thank you Michelle,

I have tried to make link like this <a href="./arg(01)/contact"> but arg(1) is not converted into uid.
I am putting this into the body of custom content. I have tried both HTML and PHP formatting.

Btw, I am not getting this link in userinfo, I am only getting Joined date and online status.

I know how to remove contact tab (at least something :)

Thank you,
Richard

michelle’s picture

Status: Fixed » Postponed (maintainer needs more info)

Hmm... That's odd. If you can see the contact tab and you're not looking at your own account, there should be a link for "Email" which is the contact link. Unfortunately, I won't have time to look into it until next week. Will be mostly offline the next few days.

How do you remove the contact tab?

Michelle

Richard_’s picture

Thank you Michelle!!!!

I beg your pardon. User that I was testing with didnt opted for contact form yet, but since I am UID=1 I have seen the contact tab in menu.

How do I remove the tab? :) Nothing pretty yet, just removing hook_menu from contact.module probably. But if you really want to know I was browsing on solution how to add new tab and I think I have seen some snippet with hook that will remove tab menu item. I will try to google it for you.

As for themeing user info did you have in mind to change advanced_profile_userinfo.tpl.php ??? Because I was trying to play with it and making changes didnt change anything. For example I tried to remove <?php print $joined; ?> from it but Joined date is still showing correctly in profile (i do not use any caching yet - I think).

As you suggested, can you point me to some tut or give me some hints on how to duplicate UserInfo code and theme this? I also wonder where is the "USER CONTEXT" stored? It is not node, nodeprofile, etc. Where is the "User picture, User info" code and template??? How can I duplicate them?

Thank you for reading this .-)

Edit:
Here is the link to tutorial Remove unwanted tabs from pages. Hope this can be helpfull.

Richard_’s picture

update in previous post.

michelle’s picture

Status: Postponed (maintainer needs more info) » Fixed

Thanks for the link.

You can add the same content type to a panel page as many times as you want. The tricky part is telling them apart. I realized I don't actualy know how to do that. But that's really a question for the panels queue.

Michelle

Richard_’s picture

Status: Fixed » Active

Sorry Michelle I dont get it. How can I clone that type? As I described?

Plus, what If I want to add different link (like edit userprofile)? How do I get that UID argument into the url, which was the initial question.

Thank you for your patience Michelle.

michelle’s picture

Status: Active » Fixed

I answered this in #1. Use arg(1) to get the UID.

As for cloning it, you just go to add content in the panel page and add it again.

Michelle

Richard_’s picture

I have tried using arg(1) before I wrote this support request. I have tried it in many ways, but nothing worked for me.

Can you suggest the solution Michelle? For example i tried this: <a href="./arg(01)/contact">

michelle’s picture

It's arg(1) not arg(01).

$uid = arg(1)
print l("Contact", "user/$uid/contact");

Michelle

Richard_’s picture

Thank you Michelle, except missing ";" after arg(1) your code does exactelly what I needed. I will use it also for nodeprofile editing link, putting them right above picture - it seems to be more user friendly for me.

<?php
$uid = arg(1);
print l("Contact", "user/$uid/contact");
?>

You are great help Michelle!!! Thank you.

michelle’s picture

Ah, yeah, I've spent most of my programming life in languages that are perfectly capable of figuring out where a line ends on their own and tend to forget those silly semicolons.

Michelle

Anonymous’s picture

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for two weeks with no activity.

halfiranian’s picture

Status: Closed (fixed) » Active

Sorry to open this again, but this seems the most promising thread on removing the contact tab on APK pages.

The email icon/link is really neat, and having the contact tab at the top is redundant.

I've followed Richard's link above (and several others) and none of them seem to remove the contact tab.

This is my version of what's offered here: http://drupal.org/node/68792#comment-725518, has anyone got this to work?

function phptemplate_menu_local_task($mid, $active, $primary) {
  //Check which tab is being rendered
  $item = menu_get_item($mid);
  //Remove core search tab
  if ($item['path'] == 'user/' . 'arg(1)' . '/contact' ) {
    return '';
  }
  //The rest is copied from theme_menu_local_task()
  if ($active) {
    return '<li class="active">'. menu_item_link($mid) ."</li>\n";
  }
  else {
    return '<li>'. menu_item_link($mid) ."</li>\n";
  }
}

Cheers,

James

michelle’s picture

Status: Active » Closed (fixed)

@peashooter - This really has nothing to do with APK. Please ask in the forums. I'm trying to clean up the issue queue.

Michelle

halfiranian’s picture

for those of you interested, just remove the apostrophes around the arg(1) part.

Slap this in your template.php:


function phptemplate_menu_local_task($mid, $active, $primary) {
    //Check each tab being rendered for our victim
    $item = menu_get_item($mid);
    
    if ($item['path'] == 'user/' . arg(1) . '/contact') {
        return '';
    }

    //The rest is copied from theme_menu_local_task()
    if ($active) {
        return '<li class="active">'. menu_item_link($mid) ."</li>\n";
    }
    else {
        return '<li>'. menu_item_link($mid) ."</li>\n";
    }
}