31
TheFinni
How can I get the user's group either in a template or in custom php?
  • 2005/9/8 0:16

  • TheFinni

  • Just popping in

  • Posts: 75

  • Since: 2003/11/25


I'm trying to customize a module to show certain information according to what group the user belongs to. How can I do this?

For instance, I know how to get the user's username by:

$xoopsUser->getVar("uname", "E");

Is there a similar way for me to call the user's groupname?

Thank you!



32
TheFinni
default admin menu js and htmlarea 2 conflict
  • 2005/8/19 20:26

  • TheFinni

  • Just popping in

  • Posts: 75

  • Since: 2003/11/25


Hi,
I stumbled upon the same errors today. Are you using XOOPS 2.2? I just upgraded and the error seems to be a conflict with the default theme administration menu javascript and HTMLArea 2.

I will post an answer if I can solve the problem.



33
TheFinni
No page refresh in admin Firefox after using HTMLArea
  • 2005/3/13 11:44

  • TheFinni

  • Just popping in

  • Posts: 75

  • Since: 2003/11/25


I thought I'd add my solution to the deal although it's along time since anyone posted in here. I tried skenow solution and it lead me to a slightly different solution.

I only needed the refresh in the administration panel since I don't use any HTML editor for users.

Instead of adding the javascript to the system_redirect.html file which redirects in the user's side. I added the javascript with some slight modifications to: "/include/functions.php". You can find the area easily by searching for the orange hr color: #E18A00

I added this after the Meta refresh tag:

<script language="javascript">
            function 
nextpage(){
          
window.location "'.$url.'";
        }
        </
script>


and this as a body element:

<body onload="setTimeout('nextpage()', 2500)">


Note! this only works in the functions.php file and skenow was probably right in how he set-up the template file which is an HTML file.



34
TheFinni
addSlashes in edit form variable?
  • 2004/10/28 20:38

  • TheFinni

  • Just popping in

  • Posts: 75

  • Since: 2003/11/25


I recently noticed a problem when editing one of my articles.

If I save something to the database such as:

That 70's show

The item is saved properly...

However when I try to edit the article, whatever was after the ' (tickmark) will not show. I.e That 70

I assume it has something to do with this XOOPS form element code:

Quote:
$sform -> addElement( new XoopsFormText( 'Favorite TV Show:', 'favoritetvshow', 50, 80, $favoritetvshow) );


I tried this:

Quote:
$sform -> addElement( new XoopsFormText( 'Favorite TV Show:', 'favoritetvshow', 50, 80, addSlashes($favoritetvshow)) );


But it only gave me:

That 70\

How can I get the addSlashes PHP code in the retrival of this entry? It is used in the saving process.
I am using the News module but have added my own custom field.

Thanks!

~Thomas



35
TheFinni
Re:istats refferrer problem,
  • 2004/10/24 22:07

  • TheFinni

  • Just popping in

  • Posts: 75

  • Since: 2003/11/25


Hi guys,
Any news on fixing the referer problem?

I am getting this error:

Fatal error: Call to undefined function: getresult() in /home/user/public_html/modules/istats/include/referer.php on line 58



36
TheFinni
Re: followed by
  • 2004/10/17 9:02

  • TheFinni

  • Just popping in

  • Posts: 75

  • Since: 2003/11/25


Mithrandir,
Thank you again for your expert advice! I had to play with your advice a little since I didn't completly understand it first...

I found some of your other advice on the forum and thought that perhaps you had placed the <{counter}> in the wrong place when offering me your help.

Here's the link to Mithrandir's other advice in case someone else is reading this post:

https://xoops.org/modules/newbb/viewtopic.php?topic_id=16684&forum=20

I am also going to explain briefly what I did and also post my code.

Basically, I didn't understand the counter assign parameter and had to do some study on Smarty's website:

http://smarty.php.net/manual/en/language.function.counter.php

What I realized is it doesn't matter what name I assign the counter. So I chose my own name.

I also couldn't get the prper numbers and hence my unique first article didn't show up the way I wanted. Therefore I tried to see what numbers I got out by using this in my template:

<{$storycount}>

And for some strange reason my first article had a number of 2 and my second a number of 3.

I managed to change this by adding to the counter assign these parameters: start=1 skip=1 (see Smarty website).

With that said...My unique recent news block article template looks like this:

Quote:
<{counter assign="storycount" print=false start=1 skip=1}>
<{foreach item=news from=$block.stories}>
<{if $storycount == 1}><p><a href="<{$xoops_url}>/modules/news/article.php?storyid=<{$news.id}>"><{$news.artimage}></a><strong><{$news.title}></strong> : <{$news.introtext}><a href="<{$xoops_url}>/modules/news/article.php?storyid=<{$news.id}>">[read more]</a> (<{$news.date}>)</p><p><strong>Other new headlines:</strong><br /><{/if}><{if $storycount > 1}>-<a href="<{$xoops_url}>/modules/news/article.php?storyid=<{$news.id}>"><{$news.title}></a> (<{$news.date}>)<br /><{/if}>
<{counter}>
<{/foreach}></p>


My website is not done yet so I can post a link but will do so another day.

Hopefully this helps someone else!

Thanks!



37
TheFinni
<{ foreach FIRST }> followed by <{ foreach REMAINDER }>
  • 2004/10/12 5:05

  • TheFinni

  • Just popping in

  • Posts: 75

  • Since: 2003/11/25


Hello,
I was wondering if someone could help me with this issue?

I would like to know if there is a way to use the;

<{foreach item=articles from=$articles}>
title 1
title 2
title 3
<{/foreach}>

and make it like:

<{foreach FIRST item=articles from=$articles}>
title 1
storytext
perhaps displaying an image
<{/foreach}>

<{foreach REMAINDER item=articles from=$articles}>
title 2
title 3
<{/foreach}>

If I could do this I could get more creative with how the templates work.

Thanks for any ideas you can provide.



38
TheFinni
Re:uploader.php and Notice: Undefined index:
  • 2004/10/11 6:14

  • TheFinni

  • Just popping in

  • Posts: 75

  • Since: 2003/11/25


I am still having problems. How important is the: enctype="multipart/form-data in the form? I managed to add it using:

$sform -> setExtra( 'enctype="multipart/form-data"' );

but the problem is still the same.

I also experiemented with an uploader found in Tinycontent and with that I get it to work...only the Tinycontent uploader allows you to upload all sort of files including txt. etc. I only want the image upload.

Please help. I am getting tired with this.

If you know of any tutorials on how to use the XOOPS uploader I would be grateful. i have search and searched but not found much. :(



39
TheFinni
Re:uploader.php and Notice: Undefined index:
  • 2004/10/10 19:59

  • TheFinni

  • Just popping in

  • Posts: 75

  • Since: 2003/11/25


Thank you Draven,
I did what you suggested. The upload function didn't complete however I got the following message from the "print_r($_POST);" you sugested:

Array ( [MAX_FILE_SIZE] => 250000 [partnerlogo] => C:\Documents and Settings\User\My Documents\My Pictures\mylogo.jpg [xoops_upload_file] => Array ( [0] => partnerlogo ) [op] => uppImage [submit] => Upload 

Errors Returned While Uploading
File not found

I don't completely understand the array. Why is there double backward slash in between the folders? Could this be the error?



40
TheFinni
Re:uploader.php and Notice: Undefined index:
  • 2004/10/10 13:33

  • TheFinni

  • Just popping in

  • Posts: 75

  • Since: 2003/11/25


Thanks Kaotik,
I don't know if I'm willing to give up on the xoopsuploader quite yet. It seems to be working in other parts of the site.

I think Draven has a point. It's pretty much the same conclusion I have come to...but I can't figure out why my variable is not being passed on?

Basically I am trying to create an image-upload for the Xoopspartners module. I think it is silly to have to input the src code for each images. Especially for those who don't know a squat about img src code(my client).

Plus there's a dissadvantage if your partner removes or changes their logo without you knowing it. (Which can currently be seen on Xoops's site where the Brazilian Support site logo is missing) ex.

https://xoops.org/modules/xoopspartners/

Anyhow, I hope someone could give me a hand with this. Basically I have made an instance where I am trying to get the image upload to work without the other form items. Here's my code:

function imageUpload()
{
    
$xoopsDB =& Database::getInstance();
    
$myts =& MyTextSanitizer::getInstance();
    
xoops_cp_header();
    echo 
"<h4>"._MD_PARTNERADMIN."</h4>";
    include 
XOOPS_ROOT_PATH."/class/xoopsformloader.php";
    
$form       = new XoopsThemeForm(_MD_ADDPARTNER"addform""index.php");
    
$op_hidden  = new XoopsFormHidden("op""uppImage");
    
$submit_button = new XoopsFormButton("""submit""Upload""submit");
    
$form->addElement($formweight);
    
//TN removed: $form->addElement($formimage);
    //TN trying to add image upload
    
$form -> addElement( new XoopsFormFile'Upload an image''partnerlogo''250000' ), false );
    
//TN EOF
    
$form->addElement($op_hidden);
    
$form->addElement($submit_button);
    
$form->display();
    
xoops_cp_footer();
}

function 
uppImage()
{

    
$allowed_mimetypes = array('image/gif''image/jpeg''image/pjpeg''image/x-png');
    
$maxfilesize 50000;
    
$maxfilewidth 120;
    
$maxfileheight 120;
    include_once(
XOOPS_ROOT_PATH."/class/uploader.php");
    
    
$uploader = new XoopsMediaUploader(XOOPS_ROOT_PATH."/modules/xoopspartners/images/uploads/"$allowed_mimetypes$maxfilesize$maxfilewidth$maxfileheight);

    if (
$uploader->fetchMedia($HTTP_POST_VARS['partnerlogo'])) {
           if (!
$uploader->upload()) {
              echo 
$uploader->getErrors();
                } else {
                       echo 
'<h4>File uploaded successfully!</h4>';
                       echo 
'Saved as: ' $uploader->getSavedFileName() . '<br />';
                       echo 
'Full path: ' $uploader->getSavedDestination();
                   }
                      } else {
    echo 
$uploader->getErrors();
  }

exit();
}


But I am getting the following error:

Errors Returned While Uploading
File not found
Notice [PHP]: Undefined variable: HTTP_POST_VARS in file c:\web\xoops\modules\xoopspartners\admin\index.php line 196




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



Login

Who's Online

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


Members: 0


Guests: 239


more...

Donat-O-Meter

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

Latest GitHub Commits