1
trspice
How can I re-locate the Submit link for news module.
  • 2007/12/5 22:38

  • trspice

  • Not too shy to talk

  • Posts: 193

  • Since: 2007/3/24


I don't use the XOOPS main menu block and I want the News module submit link to display at the top of the news pages and visible only for each group permitted to submit(just as it functions now in the main menu).

I searched the site for an hour and didn't find any post with a solution. Does anyone have a solution for this?
There's nothing but science....
The Reggae Album

2
BlueStocking
Re: How can I re-locate the Submit link for news module.

The TIP: there might give you a useful idea for what you are trying to accomplish.

Operation Manual 1.2 Modules tip

hope this helps,
if not then
hope someone comes along soon with the answer you need.

BS
hhttps://xoops.org/modules/repository .. It is time to get involved - XOOPS.ORG

3
preachur
Re: How can I re-locate the Submit link for news module.
  • 2007/12/6 8:09

  • preachur

  • Just can't stay away

  • Posts: 525

  • Since: 2006/2/4 4


Personally, I hack most of the modules' templates and put submit buttons on them. News included. For example: I want a button to submit news on the top of my main news page. I would edit: modules/news/templates/news_index.html

Wherever I want the button I would add this:

<FORM METHOD='LINK' ACTION='<{$xoops_url}>/modules/news/submit.php'>
<
INPUT TYPE='submit' VALUE='Add Your News'>
FORM><br><br><small>[You must be a <a href=<{$xoops_url}>/register.php>registered userato post news... It's FREE.]


This shows the button to everyone, but gives the register link and a notice that you must be registered.

Now, I have never tried it, but this should work to show it only to registered users and webmasters:

<{if !$xoops_isuser}>
    
    
You must be a <a href="<{$xoops_url}>/register.php">registered userato post news.
    <{else}>
    <
FORM METHOD='LINK' ACTION='<{$xoops_url}>/modules/news/submit.php'>
<
INPUT TYPE='submit' VALUE='Add Your News'>FORM>
    
    <{/if}>


I haven't tested it, but it should work.

Correction: it works fine.
Magick can never be restrained, but when freely given is thrice regained!

4
trabis
Re: How can I re-locate the Submit link for news module.
  • 2007/12/6 13:59

  • trabis

  • Core Developer

  • Posts: 2269

  • Since: 2006/9/1 1


Add this lines before the end of index.php:
//start
$groups is_object($xoopsUser) ? $xoopsUser->getGroups() : XOOPS_GROUP_ANONYMOUS;
$gperm_handler =& xoops_gethandler('groupperm');
if (
$gperm_handler->checkRight('news_submit'0$groups$xoopsModule->getVar('mid'))) {
    
$perm 1;
} else {
    
$perm 0;
}
$xoopsTpl->assign('perm'$perm);
//end

include_once XOOPS_ROOT_PATH.'/footer.php';
?>


Then you could use preachur code with a small change.
(Use the following code in news_index.html and news_by_topic.html)
<{if !$perm}>
    
You must be a <a href="<{$xoops_url}>/register.php">registered userato post news.
<{else}>
    <
FORM METHOD='LINK' ACTION='<{$xoops_url}>/modules/news/submit.php'>
<
INPUT TYPE='submit' VALUE='Add Your News'>FORM>
<{/if}>


I made this changes because XOOPS user might not have previlege for submit news.

PS: Not tested it but it should work

5
trspice
Re: How can I re-locate the Submit link for news module.
  • 2007/12/8 23:52

  • trspice

  • Not too shy to talk

  • Posts: 193

  • Since: 2007/3/24


trabis the method you suggest is exactly what I need however when I apply it I get the following error
Quote:

Fatal error: Call to a member function getVar() on a non-object in /home/icinc/public_html/index.php on line 48


The strange thing is that all subsequent pages work fine.

This is how my index.php file is written
include "mainfile.php";

//check if start page is defined
if ( isset($xoopsConfig['startpage']) && $xoopsConfig['startpage'] != "" && $xoopsConfig['startpage'] != "--" ) {
    
header('Location: '.XOOPS_URL.'/modules/'.$xoopsConfig['startpage'].'/');
    exit();
} else {
    
$xoopsOption['show_cblock'] =1;
    include 
"header.php";
    
$xoopsTpl->assign'is_homepage',true);
    
    
$groups is_object($xoopsUser) ? $xoopsUser->getGroups() : XOOPS_GROUP_ANONYMOUS
    
$gperm_handler =& xoops_gethandler('groupperm'); 
    if (
$gperm_handler->checkRight('news_submit'0$groups$xoopsModule->getVar('mid'))) { 
    
$perm 1
    } else { 
    
$perm 0
    } 
    
$xoopsTpl->assign('perm'$perm);

    include 
"footer.php";
}
?>
There's nothing but science....
The Reggae Album

6
trabis
Re: How can I re-locate the Submit link for news module.
  • 2007/12/9 13:18

  • trabis

  • Core Developer

  • Posts: 2269

  • Since: 2006/9/1 1


OHHH, sorry. I mean modules/news/index.php and not the root one.

7
trspice
Re: How can I re-locate the Submit link for news module.
  • 2007/12/10 19:45

  • trspice

  • Not too shy to talk

  • Posts: 193

  • Since: 2007/3/24


trabis, it works perfectly... thanks. I should have given thought to applying it to the news/index.php.
There's nothing but science....
The Reggae Album

Login

Who's Online

239 user(s) are online (92 user(s) are browsing Support Forums)


Members: 0


Guests: 239


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: Nov 30
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits