11
TheFinni
Re: Display Xoops Banner Using html
  • 2007/2/6 22:13

  • TheFinni

  • Just popping in

  • Posts: 75

  • Since: 2003/11/25


Hi Lana,

The last two days I've been acquainting myself with a technique called mod_rewrite on a Apache server.

You should have a look what you can do with it.

I'm telling you because there's actually a way where you could keep your php document but "transparently" show the .htm file.

So if you have a page called mysite.com/sponsors.htm that the user types into their address bar...they would really be looking at the mysite.com/sponsors.php page.

It's a little tricky to understand first.

Here's an example that you could add in a .htaccess file inside the folder where your "sponsors" page is located at.

Options +FollowSymLinks
RewriteEngine On

RewriteRule 
^sponsors.htmsponsors.php [L]


You will have to play with the RewriteRule to make it work.

Just a thought...



12
TheFinni
Re: Which ecommerce software can I use to sell screws?
  • 2007/2/6 21:57

  • TheFinni

  • Just popping in

  • Posts: 75

  • Since: 2003/11/25


Hey Peekay,

Why don't you try the osC (osCommerce) XOOPS module by flinkUX.de?

It's basically an osCommerce pack with some pre-installed osCommerce contributions. Then you can find other contributions at osCommerce and make a rocking shop!

Good luck!



13
TheFinni
Re: after editing post return to same post?
  • 2007/2/6 21:47

  • TheFinni

  • Just popping in

  • Posts: 75

  • Since: 2003/11/25


Hi Lemernis,

Yes it makes sense. Unfortunately not all modules have logical re-directs after user actions.

Depending on the module you are using you can try to find the place where the re-direct occurs and edit to your own preferences.

In XOOPS the re-direct usually happend with the following function:

redirect_header(XOOPS_URL.'/modules/news/index.php'3'Re-direct message to user');


The first in the parenthesis is the URL where the re-direct after post goes. 2nd is time waiting for re-direct and 3rd the message to show the user.

If you can pinpoint the place you should be able to change it so it the re-direct goes where you want it.



14
TheFinni
Re: Registration Captcha Usage
  • 2007/1/30 18:48

  • TheFinni

  • Just popping in

  • Posts: 75

  • Since: 2003/11/25


Hi Kumar,

As far as jumping over the finish form you will have to work on. I guess you just need to figure out how to save the user from the first registration page.

Regarding your CAPTCHA usage you can add the following to your include/registerform.php:

include_once XOOPS_ROOT_PATH."/Frameworks/captcha/formcaptcha.php";

$reg_form->addElement(new XoopsFormCaptcha('Confirmation Code'));


and then to verify the user input in the register.php:

if(@include_once XOOPS_ROOT_PATH."/Frameworks/captcha/captcha.php") {
                
$xoopsCaptcha XoopsCaptcha::instance();
                if(!
$xoopsCaptcha->verify()) {
                    
$stop .= $xoopsCaptcha->getMessage();
                }
            }



15
TheFinni
CAPTCHA Frameworks unable to set num_chars
  • 2007/1/30 18:33

  • TheFinni

  • Just popping in

  • Posts: 75

  • Since: 2003/11/25


I don't know if I'm doing it right but I have managed to add the CAPTCHA to my form.

I am however unable to set certain configs of which the num_chars is most important to me.

It seems like "mode" and "name" are successfully set but no other values.

This is what I have so far:

include_once XOOPS_ROOT_PATH."/Frameworks/captcha/formcaptcha.php";
    
    
$rc = new XoopsFormCaptcha();
    
$reg_captcha $rc->setConfig("mode","image");
    
$reg_captcha $rc->setConfig("name","verification_code");
    
$reg_captcha $rc->setConfig("num_chars",6);
    
$reg_captcha $rc->render();
    
$reg_form->addElement($reg_captchatrue);


I would rather do it by the setConfig instead of touching the captcha config.php file (from which all settings work).



16
TheFinni
Re: Registration Extra fields?
  • 2007/1/29 20:13

  • TheFinni

  • Just popping in

  • Posts: 75

  • Since: 2003/11/25


Ok, now I have to check-out the Formulize myself. Sounds like a good module!

For those who are using the SmartProfile module I have a couple more fixes.

The form seems to miss the "name" tag in templates/smartprofile_register.html. Without the name the javascript xoopsFormValidate validation won't function.

Simply add 'name="<{$regform.name}>"' to the file.

I also noticed the insertBreak didn't produce Category headings in the template. And I wanted to be able to tell the user if a field was required or not. I'm going to copy/paste my new version of the assign function of the register.php file.

PLEASE NOTE THIS IS FOR THE PHP4 version from xooobs.net (you can modify the if object else easily for php5).

function assign($form$tpl) {
global 
$xoopsTpl;//TN added
    
    
$js $form->renderValidationJS(); //TN moved from bottom of function so I can mark fields as required
    
    //TN get/parse required fields
    
preg_match_all('/myform.[a-zA-Z0-9_]+.value/i'$js$match);
    
$req_fields $match[0];
    
$patterns[0] = '/myform./';
    
$patterns[1] = '/.value/';
    
$replacements[0] = '';
    
$replacements[1] = '';
    
$req_fields preg_replace($patterns$replacements$req_fields);

    
$i 0;
    
$elements = array();
    foreach ( 
$form->getElements() as $ele ) {
        if (
is_a($ele,'XoopsFormElement')) {
            
$n = ($ele->getName() != "") ? $ele->getName() : $i;
            
$elements[$n]['name']      = $ele->getName();
            
$elements[$n]['caption']  = $ele->getCaption();
            
$elements[$n]['body']      = $ele->render();
            
$elements[$n]['hidden']      = $ele->isHidden();
            if (
$ele->getDescription() != '') {
                
$elements[$n]['description']  = $ele->getDescription();
            }
            
//TN added for required field (getRequired() doesn't work here so use array from preg_match_all above:
            
if((isset($req_fields) && is_array($req_fields)) && (in_array($n,$req_fields))){
                
$elements[$n]['required'] = true;
            }
            
//TN EOF
        
} else {//TN not an object and likely insertBreak. let's assign:
            
$elements['ibreak'.$i]['ibreak'] = $ele;
        }
        
$i++;
    }

    
//js validate form:$xoopsTpl->assign($form->getName(), array('title' => $form->getTitle(), 'name' => $form->getName(), 'action' => $form->getAction(),  'method' => $form->getMethod(), 'extra' => 'onsubmit="return xoopsFormValidate_'.$form->getName().'();"'.$form->getExtra(), 'javascript' => $js, 'elements' => $elements));
     
$xoopsTpl->assign($form->getName(), array('title' => $form->getTitle(), 'name' => $form->getName(), 'action' => $form->getAction(),  'method' => $form->getMethod(), 'javascript' => $js'elements' => $elements));
}


Then you can modify the smartprofile_register.html file to use "$element.ibreak" and "$element.required".

Here's my template:

<div>
    <{foreach 
item=step from=$steps key=stepno name=steploop}>
        <{if 
$stepno $current_step}>
            <
a href="<{$xoops_url}>/modules/smartprofile/register.php?step=<{$stepno}>">
        <{elseif 
$stepno == $current_step}>
            <
b>
        <{/if}>
        <{
$step.step_name}>
        <{if 
$stepno $current_step}>
            </
a>
        <{elseif 
$stepno == $current_step}>
            </
b>
        <{/if}>
        <{if !
$smarty.foreach.steploop.last}>
            &
nbsp;»
        
<{/if}>
    <{/foreach}>
</
div>

<{if 
$stop}>
    <
div class='errorMsg'><{$stop_headline}><{$stop}></div>
    <
br clear='both'>
<{/if}>

<{if 
$confirm}>
    <{foreach 
item=msg from=$confirm}>
        <
div class='confirmMsg'><{$msg}></div>
        <
br clear='both'>
    <{/foreach}>
<{/if}>
<{if 
$regform}>
<
span style="font-size: x-small; color: red;"><{$smarty.const._PROFILE_AM_REG_REQ_TXT}></span>
    <
form name="<{$regform.name}>" id="<{$regform.name}>" action="<{$regform.action}>" method="<{$regform.method}>" <{$regform.extra}> >
        <
table width="100%" class="outer" cellspacing="1">
            <
tr><th colspan="2"><{$regform.title}></th></tr>
            <{foreach 
item=element from=$regform.elements}>
                <{if 
$element.ibreak}><{$element.ibreak}><{else}>
                <{if !
$element.hidden}>
                    <
tr valign='top' align='left'>
                        <
td class='head'><{$element.caption}><{if $element.description != ""}><br /><span style="font-weight: normal; font-size: x-small;"><{$element.description}></span><{/if}></td>
                        <
td class="<{cycle values='odd, even'}>"><{$element.body}><{if $element.required}> <span style="font-size: x-small; color: red;">*</span><{/if}></td>
                    </
tr>
                <{/if}><{/if}>
            <{/foreach}>
        </
table>
        <{foreach 
item=element from=$regform.elements}>
            <{if 
$element.hidden}>
                <{
$element.body}>
            <{/if}>
        <{/foreach}>
    </
form>
<{
$regform.javascript}>
<{/if}>



17
TheFinni
Re: Custom toolbar sets in FCKeditor
  • 2007/1/29 20:00

  • TheFinni

  • Just popping in

  • Posts: 75

  • Since: 2003/11/25


I agree. The information is too spread out. Having a dedicated forum sub-category for each editor would be great.

Let me know how it works for you.

Let me also know what you think about being able to set custom upload directory (if you decide to try it).

I think it would make more sense in the core not to have to restrict oneself to the root/uploads/modulename settings.



18
TheFinni
Re: Custom toolbar sets in FCKeditor
  • 2007/1/29 19:40

  • TheFinni

  • Just popping in

  • Posts: 75

  • Since: 2003/11/25


Hi Peekay,

I set a custom toolbar for FCKeditor a little differently. Instead of binding yourself to a particular name "MyToolbar" I made it so every module could set their own custom toolbar name.

I posted a comment/example in an older News article regarding the FCKeditor and Xoopseditor update. I don't know if anyone read it since News comments don't always offer notifications.

My post is a bit lengthy as I also write instructions on how to select your upload directory.

Have a look:

https://xoops.org/modules/news/article.php?storyid=3438

Thomas



19
TheFinni
Re: turn ON debug in guest mode?
  • 2007/1/29 17:34

  • TheFinni

  • Just popping in

  • Posts: 75

  • Since: 2003/11/25


Thanks phppp!

That works like a charm!



20
TheFinni
Re: Registration Extra fields?
  • 2007/1/28 17:35

  • TheFinni

  • Just popping in

  • Posts: 75

  • Since: 2003/11/25


Hi theFrenchGuy,

You might be able to control to which group the new user is added by the following trick.

Look for the following code in the register.php file:

if (!$member_handler->addUserToGroup(XOOPS_GROUP_USERS$newid)) {
        return 
_PROFILE_MA_REGISTERNG;
    }


This is what determines to which group the member is added once he/she has been inserted into the users table.

The XOOPS_GROUP_USERS is defined as 2 in mainfile and you could put any number if you wish.

So my idea is that you could tag the group you wish the user to be inserted in in the URL string.

So have a link posted like: "Coaches Register Here" which has a link like www.mydomain.com/modules/smartprofile/register.php?gid=7 where 7 is the groupid number for group "Coaches"

then just before the first mentioned code above you could add:

$gid_to_insert = isset($_GET['gid']) && $_GET['gid'] != 1 ? $_GET['gid'] : XOOPS_GROUP_USERS;

If someone changes the gid to 1 (webmasters) the group insert would default to users.

Then change the first mentioned code to:

$gid_to_insert = isset($_GET['gid']) && $_GET['gid'] != $_GET['gid'] : XOOPS_GROUP_USERS;

if (!
$member_handler->addUserToGroup($gid_to_insert$newid)) {
        return 
_PROFILE_MA_REGISTERNG;
    }


Naturally this doesn't mean only coaches could use the registration form...You could use some other field to validate they are.

As for showing particular fields in individual forms it could be achieved by adding another set of permissions. You could duplicate the admin permissions and add a set called "smartprofile_reg" permission and then use it in the form file. But it's a little bit trickier if you're new to Xoops.

I haven't tested this idea but give it a try if you feel like it.

Hope that helps a bit!




TopTop
« 1 (2) 3 4 5 ... 7 »



Login

Who's Online

217 user(s) are online (139 user(s) are browsing Support Forums)


Members: 0


Guests: 217


more...

Donat-O-Meter

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

Latest GitHub Commits