HowTo customize Send Request page

rburgundy - October 30, 2009 - 04:05
Project:User Relationships
Version:6.x-1.x-dev
Component:Miscellaneous
Category:support request
Priority:normal
Assigned:Unassigned
Status:active
Description

Hi Drupal Community-

I'm interested in editing the Send Request Page / Cancel Request Page etc.
More specifically, add more details of the action the user is about to go through. Also have the message different based on user's role.
Is this something possible with the current module?

Any advice would be very much appreciated.

#1

alex.k - October 30, 2009 - 08:03

An implementation of hook_form_alter to insec the necessary info into the form will work. Or, it can be as simple as adding a block into an appropriate spot on the page. Lots of ways to accomplish this.

#2

rburgundy - October 30, 2009 - 08:51

I'm not familiar with the hook_form_alter approach to customizing a page, so I think I'll have to try with a block. Trying to just add more description and some images above the Send Request button.

I just started to get familiar with the template files (ie user-profile.tpl.php) so I was wondering if there was an easy way to copy a template file into my new theme folder and add some css/html. I am guessing that this approach is not available in this case?

Would appreciate any more advice if possible, but will set to the status to 'fixed' as it seems I need to do some studying of drupal.

Many thanks Alex!

#3

rburgundy - October 30, 2009 - 08:55
Status:active» fixed

If you could please share with me how to set the block to only the relationship request page I would appreciate it very much.
I'm seeing http://www.example.com/drupal/relationship/9/request/1?destination=user/9
So not sure where to set the location of the block.

Thanks

#4

rburgundy - October 30, 2009 - 17:32
Status:fixed» active

Sorry - if ok with maintainer of module I would like to keep open to see if anyone else can add comments for advice until I'm able to resolve this issue I'm facing. I've looked through the README and the previous threads and haven't found info for what I want to achieve. If set to 'fixed' or 'closed' by maintainer I will be happy to leave the issue as closed, but really hoping for some help.

Thanks!

#5

rburgundy - December 7, 2009 - 02:33

bumping up.

Can anyone provide any pointers on customizing the Send Request page?

I tried adding a block - but it only allowed a region above the SEND and CANCEL buttons to be customized in a block. I would like more flexibility in customizing the Send Request page, and having the SEND and CANCEL buttons somewhere in the middle of the page, with text and images surround the buttons on the page for explanation.

Thanks

#6

alex.k - December 7, 2009 - 07:52

Really using form_alter is the best way to accomplish. Blocks are nice if you can use them, but they only exist where the theme defines them.

So, to point you in the right direction, you will need to write a small module that will implement a couple of hooks:

<?php
//hook_form_alter
function mymodule_form_user_relationships_ui_request_alter(&$form, &$form_state) {
 
$form['#theme'] = 'mymodule_style_request_form';
}
//hook_theme
function mymodule_theme($existing, $type, $theme, $path) {
 
//declare your theming function that's defined below
}

//this is your theming function
function theme_mymodule_style_request_form($form) {
 
//insert what you need into $form
  //then render the edited form
 
return drupal_render($form);
}
?>

May have made some mistakes off the top of my head, but that's the approach. See http://api.drupal.org/api/function/hook_form_FORM_ID_alter/6 and http://api.drupal.org/api/function/hook_theme/6

#7

rburgundy - December 8, 2009 - 12:56

thanks so much! I will look into writing a small module with your example above.

 
 

Drupal is a registered trademark of Dries Buytaert.