How to publish link programatically? I am creating Job portal and in that job portal When I create a Job post using admin and save that job as draft instead of posting it to all and for that draft one link is get created and I want to make that job draft link to be accessible to all users including guest.

following is the code for creating draft :

case 'draft':
        $new_node = node_load($job_node_nid,null,true);
        $new_node-&gt;status = 0;
        node_save($new_node);
        $_SESSION['bf_job_creation'] = array('step'=&gt;1);
        header('Location: ' . url('my-account'));
        break;

 This above code creates job draft but link to access that draft I just want to make that link to be accessible to all by writing code.


I have tried following code to make link accessible but not succeed :

case 'draft':
    $new_node = node_load($job_node_nid,null,true);
    $new_node-&gt;status = 0;
        $new_node-&gt;field_job_status = array(array('value'=&gt;'published'));//added this   
    node_save($new_node);
    $_SESSION['bf_job_creation'] = array('step'=&gt;1);
    header('Location: ' . url('my-account'));


break;

how to make the link to job draft public??
your problem is $new_node-&gt;status = 0;
This is setting the node to 'unpublished'.
either change the permissions to allow the users to see it or set $new_node-&gt;status = 1;
To create a link use the l() function eg. l('link text', 'node/'.$node-&gt;id);. http://api.drupal.org/api/drupal/includes!common.inc/function/l/7