1
Kalobotz
I can't check my $xoopsModuleConfig variables
  • 2004/10/5 13:42

  • Kalobotz

  • Not too shy to talk

  • Posts: 133

  • Since: 2004/5/26


I can't check my $xoopMmoduleConfig variable
if ($xoopsModuleConfig['xmyreviews_admin_a'] == '1')

I created some extra $modversion['config'] variables in the modules xoopsversion.php file and then am trying to check the variable in an if statement. It seems to work in other code I have but when I try to do it it doesn’t work. How does this work?
Are there any extra variables I need to declare or includes?

2
Anonymous
Re: I can't check my $moduyleconfig variables
  • 2004/10/5 13:59

  • Anonymous

  • Posts: 0

  • Since:


You need to add

global $xoopsModuleConfig;
in your script.

3
Mithrandir
Re: I can't check my $moduyleconfig variables

if you are in a function or method scope you need to declare it global

keep in mind that if you are in a block, you may be viewing another module's pages, in which case $xoopsModuleConfig points to the config of THAT module.

4
DonXoop
Re: I can't check my $moduyleconfig variables

This is related to something I'm working on. Besides the global $xoops_isadmin & $xoops_isuser variables I want to add a variable for specific groups.

An example is that I wanted to enable the Clear button in the Shoutbox for members of a specific group instead of just admins.

This code works fine in my Shoutbox code:
Quote:
global $xoopsUser;
$desired_group = 14;
$groups = $xoopsUser ? $xoopsUser->getGroups() : array(XOOPS_GROUP_ANONYMOUS);
if (in_array($desired_group, $groups)) {$showifadmin='yes';}


Now the Clear button will show for members of gid 14 instead of just admins. I'd like to add this to the global site variables and use it anywhere without duplicating the code. Where is the most efficient location to place it so it is available in themes and other places without repeating the eval code?

5
Mithrandir
Re: I can't check my $moduyleconfig variables

xoops_root/header.php

calculate it and assign it to $xoopsTpl and you can use it in themes and templates.

6
DonXoop
Re: I can't check my $moduyleconfig variables

purrrrfect. Thank you.

7
Kalobotz
Re: I can't check my $moduyleconfig variables
  • 2004/10/6 14:52

  • Kalobotz

  • Not too shy to talk

  • Posts: 133

  • Since: 2004/5/26


I am outside of a function and within only the file. So, I'm not running a funtion.

8
ackbarr
Re: I can't check my $moduyleconfig variables

have you updated your module in the System -> Modules admin panel since modifying the xoops_version.php script?

9
Kalobotz
Re: I can't check my $moduyleconfig variables
  • 2004/10/7 14:47

  • Kalobotz

  • Not too shy to talk

  • Posts: 133

  • Since: 2004/5/26


Yah, I have been updating allot.

I am working in the myReviews admin/index.php file and I have this if statement wrapped around the inclusion of the SPAW editor.

Here is the top part of the file:
include '../../../mainfile.php';
if ( 
file_exists(XOOPS_ROOT_PATH.'/modules/myReviews/language/'.$xoopsConfig['language']."/main.php") )
  {
    include (
XOOPS_ROOT_PATH.'/modules/myReviews/language/'.$xoopsConfig['language']."/main.php");
  }
  else
  {
    include (
XOOPS_ROOT_PATH.'/modules/myReviews/language/english/main.php');
  }
//End if

include (XOOPS_ROOT_PATH.'/modules/myReviews/admin/admin_header.php');
include (
XOOPS_ROOT_PATH.'/modules/myReviews/include/functions.php');

include (
XOOPS_ROOT_PATH.'/modules/myReviews/include/config.php');
include (
XOOPS_ROOT_PATH.'/modules/myReviews/ulconf/exten.php');

include 
XOOPS_ROOT_PATH.'/header.php';

include_once 
XOOPS_ROOT_PATH.'/class/xoopstree.php';
include_once 
XOOPS_ROOT_PATH."/class/xoopslists.php";
include_once 
XOOPS_ROOT_PATH."/include/xoopscodes.php";
include_once 
XOOPS_ROOT_PATH.'/class/module.errorhandler.php';

//include("../cache/config.php");

//EDIT: Include SPAW

    
if ($xoopsModuleConfig['xmyReviews_admin_spaw'] == '1')
    {
$module_handler = &xoops_gethandler('module');
$module = &$module_handler->getByDirname('spaw');

if (
is_object($module) && $module->getVar('isactive'))
{
    include_once 
XOOPS_ROOT_PATH "/modules/spaw/spaw_control.class.php";
}
   }
//insert finish

10
Kalobotz
Re: I can't check my $moduyleconfig variables
  • 2004/10/7 14:53

  • Kalobotz

  • Not too shy to talk

  • Posts: 133

  • Since: 2004/5/26


Where does the $xoopsModuleConfig variable come from? I'm newer to PHP so this is a little differnt.

Login

Who's Online

446 user(s) are online (300 user(s) are browsing Support Forums)


Members: 0


Guests: 446


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