Stop someone viewing document before it is published

4 replies [Last post]
poindog
Offline
Joined: 05/28/2010
Status: 
Answered

Greetings

I am trying to make it so people can only view their docuements themselves once they have paid for them. Basically they can only click on the title of the document in "Your Content" and get a result once it has been published.

I have been working on the ms_paypublish_list_content section of the module but to no avail. I would like all the output to appear in one table or alternative one table below the other.

Below is not workable but may give you the jist:

if ($status == 'Published')
$rows[] = array(
l($node->title, 'node/'. $node->nid),
$status,
$expireString,
l(t('Edit'), 'node/'. $node->nid .'/edit'),
$publishString
);
}

if ($status != 'Published')
$rows[] = array(
l($node->title),
$status,
$expireString,
l(t('Edit'), 'node/'. $node->nid .'/edit'),
$publishString
);
}

$output .= theme('table', $headers, $rows, $attr);
print theme('page', $output);
}

It would be good if the title only appears and not a path for the unpublished.

Just not sure how to merge them. Tried if else statements. Tried merging arrays etc.

Any help would be greatly appreciated.

Leighton Whiting
Offline
Joined: 06/02/2009
Poindog, If the users aren't

Poindog,
If the users aren't able to view their content, then what happens if they want to change it? Since they are the author, they will be able to view the content before it is published, but other users won't be able to view it. If really want to stop the link from showing for non-published content, you can do this:

$rows[] = array(
($node->status) ? $link = l($node->title, 'node/'. $node->nid) : $node->title,
$status,
$expireString,
l(t('Edit'), 'node/'. $node->nid .'/edit'),
$publishString
);

Sincerely,
Leighton Whiting

poindog
Offline
Joined: 05/28/2010
Leighton As soon as I typed

Leighton

As soon as I typed my request I had a feeling you would ask me that question. Anyway I am using the script to record one off documents which are not edited as opposed to classified ads which would need changes.

Thanks for the modification it worked great and I would never have figured that out.

Leighton Whiting
Offline
Joined: 06/02/2009
Glad to hear it worked out :)

Glad to hear it worked out :)

poindog
Offline
Joined: 05/28/2010
Stop hyperlink again

 

Leighton

In relation to people only able to view their documents themselves once they have paid for them.

I have managed to get it to work for version = "6.x-4.25" .

Using the method you gave me originally, it occured that when a person's period had expired they were still able ot access their document without extending their time. If you could think of a fix for this it would be great.

And Happy New Year.

 

 

Twitter Feed