Results 1 to 6 of 6
  1. #1
    New Pligger purplepomegranite's Avatar
    Joined
    Jul 2010
    Posts
    6

    Question Module path works in front-end, but not in admin area

    I'm writing an antispam module (or rather converting from another CMS) for Pligg.

    I've successfully hooked into the registration page, and now the module is working and blocking spam sign-ups according to default settings. In the _settings.php file, I need to use this path for my module:

    $path = my_pligg_base . 'modules/cedit_registrationvalidator/';

    However, this doesn't work when I go to the admin area, and I get this error:

    Warning: require_once(/modules/cedit_registrationvalidator/cedit_registrationvalidator/antispam.settings.php) [function.require-once]: failed to open stream: No such file or directory in /home/ceditbiz/public_html/pligg2/modules/cedit_registrationvalidator/cedit_registrationvalidator_settings.php on line 38

    I have tried adding a preceding slash to the path, but this also doesn't work. my_pligg_base in this case is actually empty.

    Does anyone know what the problem could be here? I am confused as to why it would work until going into the admin area.

    Working URL: http://pligg2.cedit.biz/register.php
    (the module is loaded and working here - spam/bot registrations are blocked)

    Broken URL: http://pligg2.cedit.biz/admin/admin_index.php
    (fails with fatal error as can't find include file)

  2. #2
    Pligg Developer chuckroast's Avatar
    Joined
    Jun 2006
    Posts
    5,478
    I've written over 100 modules for Pligg. I'd like to help..
    Anyway I can see the full source?
    From looking at what you've provided I would guess that the problem is within the settings.php file of the module. It's kind of hard to say exactly where the issue would be without seeing the whole thing. But that is where I would start.

    Good luck to you sir..
    If I can be any assistance.. let me know.

  3. #3
    New Pligger purplepomegranite's Avatar
    Joined
    Jul 2010
    Posts
    6
    Full source for the _settings.php file (which is where the error must be, as the path isn't being set correctly):

    Code:
    // the path to the module. the probably shouldn't be changed unless you rename the cedit_registrationvalidator folder(s)
    $rv_path = my_pligg_base . 'modules/cedit_registrationvalidator/';
    if ( !file_exists($rv_path . 'cedit_registrationvalidator/antispam.settings.php') )
    	$rv_path = my_pligg_base . '/modules/cedit_registrationvalidator/';
    	
    define('cedit_registrationvalidator_path', $rv_path);
    // the path to the module. the probably shouldn't be changed unless you rename the cedit_registrationvalidator folder(s)
    define('cedit_registrationvalidator_lang_conf', $rv_path . 'lang.conf');
    // the path to the modules templates. the probably shouldn't be changed unless you rename the cedit_registrationvalidator folder(s)
    define('cedit_registrationvalidator_tpl_path', $rv_path . 'templates/');
    
    // Read user settings
    
    // Read settings
    require_once( cedit_registrationvalidator_path.'cedit_registrationvalidator/antispam.settings.php' );
    $data = get_misc_data('cedit_rv_logsettings');
    if ( $data != '' ) {
    	$logsettings = array_merge($rv_antispam_config_logging, unserialize($data));
    } else {
    	$logsettings = $rv_antispam_config_logging;
    }
    
    $data = get_misc_data('cedit_rv_antispamsettings');
    if ( $data != '' ) {
    	$antispamsettings = array_merge($rv_antispam_config, unserialize($data));
    } else {
    	$antispamsettings = $rv_antispam_config;
    }
    
    define('cedit_rv_antispamsettings', serialize($antispamsettings));
    define('cedit_rv_logging', serialize($logsettings));
    
    
    // don't touch anything past this line.
    
    if(isset($main_smarty) && is_object($main_smarty)){
    	$main_smarty->assign('cedit_registrationvalidator_path', cedit_registrationvalidator_path);
    	$main_smarty->assign('cedit_registrationvalidator_lang_conf', cedit_registrationvalidator_lang_conf);
    	$main_smarty->assign('cedit_registrationvalidator_tpl_path', cedit_registrationvalidator_tpl_path);
    	
    	foreach ( $antispamsettings as $key => $value ) {
    		$main_smarty->assign('cedit_rv_' . $key, $value);
    	}
    	foreach ( $logsettings as $key => $value ) {
    		$main_smarty->assign('cedit_rv_log_' . $key, $value);
    	}
    }
    
    ?>
    The $rvpath hack was my attempt to correct the path issue - however, it isn't as simple as a preceding /, it seems that the path is simply invalid from the admin area. I'm probably missing something really simple... :lol:

  4. #4
    New Pligger purplepomegranite's Avatar
    Joined
    Jul 2010
    Posts
    6
    Incidentally, for the record I am serializing the settings as there are a lot of them and on looking at the Pligg source code I discovered that the get_misc_data function runs a SQL query every time it is called. If I used this method, then I'd be adding thirty or forty queries to a single page load, which wouldn't be good at all.

    I'm sure this will throw up some interesting problems when I get down to implementing the settings in the back-end, but I'll deal with that when I get there!

  5. #5
    Pligg Developer chuckroast's Avatar
    Joined
    Jun 2006
    Posts
    5,478
    Try changing line 15 from
    Code:
    require_once( cedit_registrationvalidator_path.'cedit_registrationvalidator/antispam.settings.php' );
    to
    Code:
    require_once( cedit_registrationvalidator_path.'/antispam.settings.php' );

  6. #6
    New Pligger purplepomegranite's Avatar
    Joined
    Jul 2010
    Posts
    6
    I can see why you'd think that looking at the code... however, there is actually a subdirectory cedit_registrationvalidator under the modules/cedit_registrationvalidator path. The reason for this is due to the way Joomla plugins are organised (in 1.5), and it is a port over from that.

    The full path to the antispam.settings.php file is actually modules/cedit_registrationvalidator/cedit_registrationvalidator/antispam.settings.php

Similar Threads

  1. When does the admin area appear? Why can't I see page?
    By widgetsapp in forum Questions & Comments
    Replies: 0
    Last Post: 05-08-2010, 07:38 PM
  2. How to Get into Admin Area?
    By grademoney in forum Questions & Comments
    Replies: 1
    Last Post: 04-05-2008, 01:34 AM
  3. Parse error in admin area
    By animas in forum Questions & Comments
    Replies: 2
    Last Post: 10-17-2007, 07:26 AM
  4. admin area is adding WWW to url
    By newuser in forum Questions & Comments
    Replies: 2
    Last Post: 03-06-2007, 06:10 PM
  5. Admin Area not showing
    By ozo in forum Questions & Comments
    Replies: 0
    Last Post: 01-29-2007, 07:08 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Pligg Modules and Pligg Templates from Pligg Pro Donate to Pligg CMS Dreamhost Web Hosting Host Gator Web Hosting