Posting a News Article to a Subcategory

Have a question or a suggestion about a 3rd party addon module or plugin?
Let us know here.
Post Reply
User avatar
Nullig
Power Poster
Power Poster
Posts: 2380
Joined: Fri Feb 02, 2007 4:31 pm

Posting a News Article to a Subcategory

Post by Nullig »

I'm trying to post news articles to a subcategory from the Front End. My link to fesubmit is:

Code: Select all

index.php?page=post-news&category=Family | Events
The "post-news" page has the News tag as follows:

Code: Select all

{news action='fesubmit' category=$params['category'] formtemplate='Family'}
I also tried:

Code: Select all

{news action='fesubmit' category="$params['category']" formtemplate='Family'}
I changed this part of the action.fesubmit.php from:

Code: Select all

if( isset( $params['category'] ) )
  {
    $query = 'SELECT news_category_id FROM '.cms_db_prefix().'module_news_categories WHERE news_category_name = ?';
    $tmp = $db->GetOne($query,array($params['category']));
    if( $tmp ) $category_id = $tmp;
  }
to:

Code: Select all

if( isset( $params['category'] ) )
  {
    $query = 'SELECT news_category_id FROM '.cms_db_prefix().'module_news_categories WHERE long_name = ?';
    $tmp = $db->GetOne($query,array($params['category']));
    if( $tmp ) $category_id = $tmp;
  }
hoping that by using long_name in the query it would work, but it still posts the article to the "Family" category.

Any ideas?

Nullig
calguy1000
Support Guru
Support Guru
Posts: 8169
Joined: Tue Oct 19, 2004 6:44 pm

Re: Posting a News Article to a Subcategory

Post by calguy1000 »

well, anything in  your URL will be available in $smarty.get, not $params

i.e: if you have Add a new family event
on a page,  you would have to trap the category with {$smarty.get.category}

also, the | character could be getting lost in the url..... try printing out {$smarty.get.category} to see what it's like on the destination page.

Also, yeah, that query looks a little off and long name looks like the correct solution, IF | the character is not being translated somewhere.
Follow me on twitter
Please post system information from "Extensions >> System Information" (there is a bbcode option) on all posts asking for assistance.
--------------------
If you can't bother explaining your problem well, you shouldn't expect much in the way of assistance.
User avatar
Nullig
Power Poster
Power Poster
Posts: 2380
Joined: Fri Feb 02, 2007 4:31 pm

Re: Posting a News Article to a Subcategory

Post by Nullig »

{$smarty.get.category} prints the full subcategory correctly.

Now how do I pass that on?

Nullig
calguy1000
Support Guru
Support Guru
Posts: 8169
Joined: Tue Oct 19, 2004 6:44 pm

Re: Posting a News Article to a Subcategory

Post by calguy1000 »

because of some recent wierdities I've recently found in smarty, I recommend you try this:

{assign var='tmp' value=$smarty.get.category}
{news action='fesubmit' category="$tmp"}

Notice the double quotes around $tmp
Follow me on twitter
Please post system information from "Extensions >> System Information" (there is a bbcode option) on all posts asking for assistance.
--------------------
If you can't bother explaining your problem well, you shouldn't expect much in the way of assistance.
User avatar
Nullig
Power Poster
Power Poster
Posts: 2380
Joined: Fri Feb 02, 2007 4:31 pm

Re: Posting a News Article to a Subcategory

Post by Nullig »

Thanks, calguy. That did the trick.

Nullig
User avatar
blast2007
Power Poster
Power Poster
Posts: 508
Joined: Wed Aug 01, 2007 5:36 pm

Re: Posting a News Article to a Subcategory

Post by blast2007 »

Nullig wrote: I'm trying to post news articles to a subcategory from the Front End. My link to fesubmit is:
Dear Nullig,
I have a problem similar to yours.
I'm trying to force a group of users to create/edit/delete news in a specific subcategory using FEU/CC.

The question is: "is it possible to use a kind of WYSIWYG editors within FEU to edit/create news?"

Sorry if this question was already posted.

Regards
blast
User avatar
Nullig
Power Poster
Power Poster
Posts: 2380
Joined: Fri Feb 02, 2007 4:31 pm

Re: Posting a News Article to a Subcategory

Post by Nullig »

Currently, there's no way to edit/delete news articles, but frontend users can create articles.

The WYSIWYG editor is available to the frontend, if you select an editor in Admin/Global Settings via the "Frontend wysiwyg:" field.

Nullig
User avatar
blast2007
Power Poster
Power Poster
Posts: 508
Joined: Wed Aug 01, 2007 5:36 pm

Re: Posting a News Article to a Subcategory

Post by blast2007 »

Nullig wrote: The WYSIWYG editor is available to the frontend, if you select an editor in Admin/Global Settings via the "Frontend wysiwyg:" field.
Ops...I miss that field! Thanks
Nullig wrote: Currently, there's no way to edit/delete news articles, but frontend users can create articles.
Nullig
I know, infact I'm trying to create an UDT for editing/deleting  news articles with FEU/CC modules.

Someone has already tried this.

Regards
blast
Last edited by blast2007 on Wed Mar 26, 2008 11:12 pm, edited 1 time in total.
User avatar
Nullig
Power Poster
Power Poster
Posts: 2380
Joined: Fri Feb 02, 2007 4:31 pm

Re: Posting a News Article to a Subcategory

Post by Nullig »

If you do find a way to edit/delete, please post the code here - I, for one, would be interested in using it.

Nullig
User avatar
blast2007
Power Poster
Power Poster
Posts: 508
Joined: Wed Aug 01, 2007 5:36 pm

Re: Posting a News Article to a Subcategory

Post by blast2007 »

Nullig wrote: If you do find a way to edit/delete, please post the code here - I, for one, would be interested in using it.

Nullig
The code is almost ready.

Using a simple UDT and modules FormBuilder, FEU, CC you can edit/delete all news in frontend, limiting also activities to specific category "per user".

Stay tuned ;)

Regards
blast
User avatar
Nullig
Power Poster
Power Poster
Posts: 2380
Joined: Fri Feb 02, 2007 4:31 pm

Re: Posting a News Article to a Subcategory

Post by Nullig »

Looking forward to this...

Nullig
xmas3
Forum Members
Forum Members
Posts: 41
Joined: Sat Jul 28, 2007 9:22 am

Re: Posting a News Article to a Subcategory

Post by xmas3 »

Hi, I would like to do the same, let the users using FEU edit/modify news they submitted.
Is the UDT already available?
Thanks a lot,
Miro
clj83
Forum Members
Forum Members
Posts: 195
Joined: Tue Jul 07, 2009 4:09 pm

Re: Posting a News Article to a Subcategory

Post by clj83 »

Hi,

Did you ever manage to create a UDT to allow a front end user to edit the news article they submitted through the fesubmit function?

Thanks

Chris
Schaboo
Forum Members
Forum Members
Posts: 13
Joined: Thu Sep 10, 2009 8:21 pm

Re: Posting a News Article to a Subcategory

Post by Schaboo »

Hi. Im trying to do exactly what Nullig (above) did i.e. use a smarty variable (passed from another page as a param) to specify the category in fesubmit i.e {assign var='tmp' value=$smarty.get.category}{news action='fesubmit' category="$tmp"}.
BUT, when a user submits the fesubmit form , the page refreshes (rather than redirecting to my specified page_id), and the news story is not added.
If I hardcode the category name eg. {news action='fesubmit' category="myname"}, the fesubmit form works perfectly and news stories can be added fine by front end users.
The smarty variable is definately passed to the page - I can print it using {$smarty.get.category} and feuser even selects the default category on the pulldown menu based on this variable.
Ive also tied passing the variable using POST. Again, I can print the variable {$smarty.post.category}, and FEuser recognises it for the pull down menu, but the submit fails. Can anyone help?
Post Reply

Return to “Modules/Add-Ons”