0

Maybe I'm way off mark here. I have an Node 'application' page and require that the current view page be referenced within a following page after a logged in user has clicked the 'Apply' link (a Rules Link). The above node allows a user to apply for an advertised role say a musician for a bands project guitarist vacancy, but basically its like any other Jobsboard type process.

I can get my Nodes related with the Relation model, but that's not the issue. The issue is that I need to get the relation of the current viewed page so that once the User applies, the said Node will be referenced for later recall in any applicant or Advertiser's dashboard. At the moment, all that happens is that the Rules link takes an Applicant user to a custom vacancy complete form page (which I have made using Panel Pages) and it fires off fine, but there is no link to either parties involved for me to then manage back-end and build further functionality on.

I want to grab the Job Node URL so that after a user hits an 'Apply' Rules Link button (shown on the Job node page bottom) it then makes a note of the said Node (URL) so that a number of Rules Actions such as create a new Node number; create a relationship to the Applicant; saved a new entity as an Application Node. I can manage to get the 'Submit' to trigger to the application page, and 'send it' but I'm not sure at what stage or where temporarily the said Node url path needs to be set prior to Rules then taking it and working through it's Rules actions (ie, post application, send email to application, send message to Advertiser you have a 'new' applicant whereas after they can do further tasks (outside of this question posted here).

Or, maybe my approach is completely off goal. Maybe the only important point is to get the Rules Link to relate to the currently viewed Node (job position in question offered) which when triggered will then relate the user to any other uses. I'm not sure, but even looking at first loading any Node, is it possible that the Rules Link has to already pull in the Node ID once the user clicks to view the Node on screen, then the Rules Link will have already built a relationship?

Hope the above is not too confusing! but I've tried to express my mental ideas. I would like to do this in Rules. (I'm using Rules, Rules Link, Views).

Failing all of that, how do I link in a User application to relation to the original post so that the advertiser can see who has applied to the said vacancy advertised?

Please, where am I going wrong in my approach and what am I missing?
Much appreciated. Thanks.

Revised question: 21/05/14.

4
  • what do you mean by "create a new node number", and "create a relationship to the applicant"? Can you add some details on what exactly these are meant to accomplish - context may help give you better guidance
    – Geoff
    May 18, 2014 at 5:01
  • I may be able to find a temp workaround using the drupal.org/project/serial module as this will give me a Serial number which I can relate application using Relation. I posted my comments on any success later.
    – Paul B
    May 19, 2014 at 10:51
  • I have revised my original question, please review and consider any answers. Thanks.
    – Paul B
    May 21, 2014 at 11:14
  • I don't want to add confusion but have you looked at entities. I'm not sure how you'd do this in rules but have a fair idea of how it could be done using the entity API
    – Deejay
    Nov 3, 2014 at 22:12

1 Answer 1

0
+50

A custom way to do it... Sorry not using Rules but it might help.

So you have two main node types ? And advert and an application ? And the link to the application needs to contain the node ID of the advert. I would use a custom link and hook_form_alter. For example;

If the apply link is only seen on the advert node page then you can use:

$nid = arg(1);
print l(t("Apply"), "node/add/application/$nid");

either in a node.tpl.php or in a preprocess function.

This will take the user to the node add form. In a custom module you use hook_form_alter to get the $nid from the URL and add it to the form in the in the right field such as :

/**
 * Implements hook_form_alter().
 */
function custommod_form_alter(&$form, &$form_state, $form_id) {
  if ($form['#id'] == 'application-node-form') {
    if (isset(arg(3))) {
      $form['field_advert_relation'][LANGUAGE_NONE][0]['target_id']['#default_value'] = arg(3);
    }
  }
}

This is for a normal entity reference field. And the field could be disabled or hidden also.

3
  • Thank you for your reply which is along the lines of what I want and still helpful all the same. It's possible Rules can't do what I need, I'm a PHP novice which doesn't help LOL! I'm not sure at this moment if it will work and I'll have to see if I can 'hack' it myself later. The bonus expires later, so if no-one else can offer a solution then I'll make sure someone gets it for their efforts. Thanks again.
    – Paul B
    Nov 7, 2014 at 10:56
  • sure thing. You might be able to use 'entity reference pre-populate' which would set the application's advert id using a similar approach. And to format the link to use the pre-populate you could create a view with a re-written output field. Nov 7, 2014 at 13:08
  • That all sounds good. ATMIT, I'm not really bothered how I get the function working just as long as I can get it up and running for the site project. I've had a basic look at the entity ref before so I'll look again and try to figure it out. Maybe even the results can after all be linked into some Rules config if that would then even be needed, I can but try. Cheers.
    – Paul B
    Nov 7, 2014 at 13:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.