Hope this hasn't been discussed already but I would like to add some php(or whatever else it takes) to an image button to become a friend. I don't like the text link already included. Please offer solution or point me in the right direction. Thanks

Dan

CommentFileSizeAuthor
#2 users_relationship-447500-1.patch693 bytesMisterSpeed

Comments

MisterSpeed’s picture

Assigned: Unassigned » MisterSpeed
MisterSpeed’s picture

Status: Active » Fixed
StatusFileSize
new693 bytes

Please find patch file for the css changes, The image path you can change, currently the patch using the default background image.

jaydub’s picture

Status: Fixed » Active

What you need to do is override the default theme function that generates the Add/Remove relationships links.

These default theme functions are all defined in user_relationships/user_relationships_ui/user_relationships_ui.theme.inc

In case you don't know the drupal theming layer:

http://drupal.org/node/341628

The "Drupal Way" is to do an override. This involves four basic steps:

1. Locate the module responsible for the markup
2. Do one of the following:
* If the module provides a template, copy the .tpl.php file to your theme directory. See Core Templates and Suggestions for a list of core templates.

OR
* Within the module, identify the function that is generating the markup you want to change and copy the function to your theme.
3. Change the HTML code within the copied function or template.
4. Refresh the theme cache.

If we take one example theme function:

/**
 * Create relationship link
 */
function theme_user_relationships_request_relationship_link(&$relate_to) {
  return l(
    t('Create a relationship with %name', array('%name' => $relate_to->name)),
    "relationship/{$relate_to->uid}/request",
    array(
      'query' => drupal_get_destination(),
      'html'  => TRUE,
    )
  );
}

If you wanted to override this and change the text link to an image you could do something like:

function phptemplate_user_relationships_request_relationship_link(&$relate_to) {
  $img = theme('image', PATH_TO_IMAGE); // You supply the image path
  return l($img, "relationship/{$relate_to->uid}/request", array('query' => drupal_get_destination(), 'html'  => TRUE));
}
MisterSpeed’s picture

Status: Active » Needs review

we change the css file for this, we put the background image for the link which are default created by theme function, the pach file have little css change to make Become a Friend link to image buttom. --- A.s.

alex.k’s picture

Status: Needs review » Fixed

Thank you both. The point of @jaydub is we should not advocate changes to the core module files, because if the person follows instructions and patches, they will lose the changes when they update the module. Hence overriding the template file, or putting CSS changes into the site's custom theme if there is one.

That said I believe there is enough information here for the original poster to work with. Please reopen if additional support is needed. Thanks.

63reasons-AS’s picture

Assigned: MisterSpeed » 63reasons-AS

Status: Fixed » Closed (fixed)

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