I am trying to use the the Submit Content form.
Please can you advise me how to populate the created_by field in jos_content with the current userid?
Currently it stores 0 (administrator?) so the author cannot subsequently edit his page.
Please can you advise me how to populate the created_by field in jos_content with the current userid?
Currently it stores 0 (administrator?) so the author cannot subsequently edit his page.
Hi jbudd,
please show me the code in the "onSubmit after email" box of the form!
Cheers
Max
please show me the code in the "onSubmit after email" box of the form!
Cheers
Max
This is what I have in On Submit After Email:
I can see it is easy to insert a static value here such as $_Post['state'] = '1' - to make the content item automatically published, but I dont know how to access the current user ID.
For the alias, in the standard submit content component there is some code which changes the title to lowercase and substitutes hyphens for spaces. My PHP is probably up to reproducing this function... I havent yet worked out the complete significance of article aliases in J1.5.
jb
<p><span style="color: #0000ff;"><strong>Thank you for submitting your story. You can view it by selecting "Practice Pages"</strong></span></p>
<?php
$_POST['catid'] = '30';
$_POST['id'] = '';
$_POST['sectionid'] = '6';
$_POST['state'] = '1';
$_POST['created'] = date("Y-m-d H:i:s");
?>
I can see it is easy to insert a static value here such as $_Post['state'] = '1' - to make the content item automatically published, but I dont know how to access the current user ID.
For the alias, in the standard submit content component there is some code which changes the title to lowercase and substitutes hyphens for spaces. My PHP is probably up to reproducing this function... I havent yet worked out the complete significance of article aliases in J1.5.
jb
Hi jbudd,
It's something like
Bob
It's something like
<?php
$user = JFactory::getUser();
$_POST['id'] = $user->id;
?>
Bob
Thanks Greyhead!
That suggestion works fine, except the field is 'created_by' not 'id'
jb
That suggestion works fine, except the field is 'created_by' not 'id'
jb
I'm also trying to do this. So would I change the onsubmit after email to.
<p><span style="color: #0000ff;"><strong>Thank you for submitting your story. You can view it by selecting "Practice Pages"</strong></span></p>
<?php
$_POST['catid'] = '30';
$_POST['created_by'] = $user->id;
$_POST['sectionid'] = '6';
$_POST['state'] = '1';
$_POST['created'] = date("Y-m-d H:i:s");
?>
and before using
Cheers
Max
$user->id
you need: $user = JFactory::getUser();
Cheers
Max
This topic is locked and no more replies can be posted.