Vodes for Joomla 1.5
- elina
- Offline
- New Member
Less
More
- Thank you received: 0
15 years 9 months ago #3913
by elina
Hello,
i am trying to use vodes_util.php & the code that posted in this topic but unfortunatelly i can't subtract credits from user... and there is no error
i would like to use vodes with my upload/download component. When a user uploads a file i want to be charged with -40credits
In vodes_util.php 1) i changed $uid to $usrid (because there was already the variable $uid inside functions in .php file of the component's and i want 'vodes' $uid to be 'different'..) and 2) SET credit=credit-40.
I add the folowing code in the only .php file of the upload/download component at components directory (not administator)
i also tried to put the above code inside in a function like: function credits_validation() { ... }
and call it from several places of .php code but unfortunatelly credits not charged.
Can you please help me... I don't know what else to try
i am trying to use vodes_util.php & the code that posted in this topic but unfortunatelly i can't subtract credits from user... and there is no error
i would like to use vodes with my upload/download component. When a user uploads a file i want to be charged with -40credits
In vodes_util.php 1) i changed $uid to $usrid (because there was already the variable $uid inside functions in .php file of the component's and i want 'vodes' $uid to be 'different'..) and 2) SET credit=credit-40.
I add the folowing code in the only .php file of the upload/download component at components directory (not administator)
require_once('vodes_util.php'); // at the top
$myname =& JFactory::getUser();
$usrid = $myname -> id;
$vode = new Vodes();
if( $vode -> getVodes( $usrid ) <= 0){ // if not enough vode
$mainframe->redirect( JRoute::_("index.php?option=com_vodes") , JText::_('You do not have enough credits. So please buy credits to upload'));
}
else if ( $vode -> getVodes( $uid ) >= 40)){
$vode -> spendVodes( $usrid ); // spend one vode from user's current credits/vodes
i also tried to put the above code inside in a function like: function credits_validation() { ... }
and call it from several places of .php code but unfortunatelly credits not charged.
credits_validation();
Can you please help me... I don't know what else to try
Please Log in or Create an account to join the conversation.
- elina
- Offline
- New Member
Less
More
- Thank you received: 0
15 years 8 months ago #4009
by elina
Hello,
i am still stack in this, credits not charged.
please any help would be appreciated. i want so much to use this component... but unforunately i am not a programmer
waiting your news
i am still stack in this, credits not charged.
please any help would be appreciated. i want so much to use this component... but unforunately i am not a programmer
waiting your news
Please Log in or Create an account to join the conversation.
- elina
- Offline
- New Member
Less
More
- Thank you received: 0
15 years 8 months ago #4010
by elina
Hi,
this is the code of the ftp component's upload button:
I have added at the top of .php file:
and after the 'post' form i have added the following code:
What am i doing wrong. I have tried alot of combinations in the above code... The only progress was, when i put at the top of file $vode->spendVodes( $usrid ); ...but then Vodes charges every time the user visits the page
Also my vodes_util.php looks like this:
this is the code of the ftp component's upload button:
<td height="26" colspan="2"><input type="hidden" id="hidIsFilePath" name="hidIsFilePath" value="<?php echo $hidIsFilePath; ?>"/>
<input type="submit" name="upload" id="upload" value="Upload" onclick="return validation();" /></td>
I have added at the top of .php file:
require_once('vodes_util.php');
$user =& JFactory::getUser();
$usrid = $user->get('id');
$vode = new Vodes();
and after the 'post' form i have added the following code:
<?php
if (isset($_POST['upload']))
{
credits();
}
?>
<?php
function credits()
{
if( $vode->getVodes( $usrid ) <= 0){
$mainframe->redirect( JRoute::_("index.php?option=com_vodes") , JText::_('You do not have enough credits. So please buy credits to upload'));
}
else {
$vode->spendVodes( $usrid );
}
}
?>
<?php
What am i doing wrong. I have tried alot of combinations in the above code... The only progress was, when i put at the top of file $vode->spendVodes( $usrid ); ...but then Vodes charges every time the user visits the page
Also my vodes_util.php looks like this:
function getVodes( $usrid ){
$database =& JFactory::getDBO();
$sql = "SELECT credit FROM #__vode_credits WHERE userid='$usrid'" ;
$database->setQuery( $sql );
$balance = $database->loadResult();
return $balance ? $balance : 0;
}
function spendVodes( $usrid ){
$database =& JFactory::getDBO();
echo $usrid;
$sql = "UPDATE #__vode_credits SET credit=credit-40 WHERE userid='$usrid'";
$database->setQuery( $sql );
if( !$database->query()) return false;
return true;
}
Please Log in or Create an account to join the conversation.
- Graph
- Offline
- New Member
Less
More
- Thank you received: 0
15 years 8 months ago - 15 years 8 months ago #4034
by Graph
Hello,
Please advice how to get spending credits in the photo component Phoca Gallery?
I need some detailed instructions, please.
I apologize for my stupid question, and even worse English,
thank you verry much
David
My vodes_util.php is:
Please advice how to get spending credits in the photo component Phoca Gallery?
I need some detailed instructions, please.
I apologize for my stupid question, and even worse English,
thank you verry much
David
My vodes_util.php is:
<?php
/**
* @package Vodes_Joomla_1.5
* @Copyright (C) 2008 Rakibul Hasan, rhasan082@gmail.com
* @All Rights Reserved
*/
class Vodes {
/*
* Constructor do nothing
*/
function Vodes(){}
/**
* This function provides the the remianing credit of a user
* @param user_id User Id whose current credits going to be retrieved
* @return credits remaining for the user
*/
function getVodes( $userid ){
$database =& JFactory::getDBO();
$sql = "SELECT credit FROM #__vode_credits WHERE userid='$userid'" ;
$database->setQuery( $sql );
$balance = $database->loadResult();
return $balance ? $balance : 0;
}
/**
* This function will spend 'amount' of credits for a user
* @param user_id User Id whose credits will be spent
* @param amount Amount to spend
* @return boolean success status
*/
function spendVodes( $userid ){
$database =& JFactory::getDBO();
echo $userid;
$sql = "UPDATE #__vode_credits SET credit=credit-1 WHERE userid='$userid '";
$database->setQuery( $sql );
if( !$database->query()) return false;
return true;
}
}
?>
Last Edit: 15 years 8 months ago by Graph.
Please Log in or Create an account to join the conversation.
- nebris
- Offline
- New Member
15 years 4 months ago #4673
by nebris
Hi!
My English is not great so sorry for errors and a Please help!
I use JDownloads and the entire component is basically a file. We ask you to help where I can put the code that have been deducted points for entry to the download page
I tried to paste the code below but does not work:
(Should the catalog Jdownloads add some files?)
<? require_once('vodes_util.php');
$my = & JFactory::getUser();
$uid = $my -> id;
?>
<?php $vode->updateVodes($uid)?>
Very Please Help! The following piece of code responsible for the download page is displayed.
In the Annex, the entire file
If you do not know the component JDownloads is for download from here:
http://demo.joomlaaddons.de/index.php?option=com_jdownloads&Itemid=69&task=viewcategory&catid=17
( Registration is not required, English language )
My English is not great so sorry for errors and a Please help!
I use JDownloads and the entire component is basically a file. We ask you to help where I can put the code that have been deducted points for entry to the download page
I tried to paste the code below but does not work:
(Should the catalog Jdownloads add some files?)
<? require_once('vodes_util.php');
$my = & JFactory::getUser();
$uid = $my -> id;
?>
<?php $vode->updateVodes($uid)?>
Very Please Help! The following piece of code responsible for the download page is displayed.
In the Annex, the entire file
/* #########################################
/ DOWNLOAD
/ ####################################### */
function Summary($option, $marked_files_id, $mail_files, $filename, $download_link, $del_ok, $extern_site){
global $database, $jlistConfig, $jlistTemplates, $mosConfig_live_site, $mosConfig_absolute_path, $my, $Itemid, $mainframe;
$mainframe->setPageTitle( $jlistConfig['jd.header.title'].' - '._JLIST_BACKEND_TEMP_TYP3 );
$html_sum = makeHeader($html_sum, false, false, false, 0, false, false, false, true, false, 0, $sum_pages, $list_per_page, $total, $list_start);
echo $html_sum;
// build output from template
$html_sum = $jlistTemplates[3][0]->template_text;
$html_sum = str_replace('{download_liste}', $mail_files, $html_sum);
$html_sum = str_replace('{title_text}', _JLIST_FE_SUMMARY_PAGE_TITLE_TEXT, $html_sum);
$html_sum = str_replace('{license_note}', _JLIST_FE_SUMMARY_PAGE_LICENSE_NOTE, $html_sum);
// summary pic
$sum_size = $jlistConfig['cat.pic.size'];
$sumpic = '<img src="components/com_jdownloads/images/summary.png" width="'.$sum_size.'" height="'.$sum_size.'" border="0" alt="" /> ';
$html_sum = str_replace('{summary_pic}', $sumpic, $html_sum);
if (count($marked_files_id) > 1) {
$html_sum = str_replace('{download_link}', '<div style="text-align:center"><a href="'.$download_link.'" target="_self" title="'._JLIST_LINKTEXT_ZIP.'"><img src="images/jdownloads/downloadimages/'.$jlistConfig['download.pic.details'].'" border="0" alt="'._JLIST_LINKTEXT_ZIP.'" /></a></div>', $html_sum);
$html_sum = str_replace('{external_download_info}', '', $html_sum);
} else {
if ($extern_site){
// link target=_blank
$link = '<div style="text-align:center"><a href="'.$download_link.'" target="_blank" title="'._JLIST_LINKTEXT_ZIP.'" ><img src="images/jdownloads/downloadimages/'.$jlistConfig['download.pic.details'].'" border="0" alt="'._JLIST_LINKTEXT_ZIP.'" /></a></div>';
$html_sum = str_replace('{download_link}', $link, $html_sum);
// add info about extern file link
$html_sum = str_replace('{external_download_info}', _JLIST_FRONTEND_DOWNLOAD_GO_TO_OTHER_SITE_INFO, $html_sum);
} else {
$link = '<div style="text-align:center"><a href="'.$download_link.'" target="_self" title="'._JLIST_LINKTEXT_ZIP.'" ><img src="images/jdownloads/downloadimages/'.$jlistConfig['download.pic.details'].'" border="0" alt="'._JLIST_LINKTEXT_ZIP.'" /></a></div>';
$html_sum = str_replace('{download_link}', $link, $html_sum);
$html_sum = str_replace('{external_download_info}', '', $html_sum);
}
}
$footer = makeFooter(true, false, false, 0, 0, 0, 0);
$html_sum .= $footer;
echo $html_sum;
}
If you do not know the component JDownloads is for download from here:
http://demo.joomlaaddons.de/index.php?option=com_jdownloads&Itemid=69&task=viewcategory&catid=17
( Registration is not required, English language )
Please Log in or Create an account to join the conversation.
- Saka
- Offline
- Administrator
15 years 4 months ago #4676
by Saka
Emir Sakic
www.sakic.net
The author is only providing professional support and fee based coding services for this component. If interested, contact me for quote on mail. Other users are welcome to discuss of course.
Emir Sakic
www.sakic.net
Please Log in or Create an account to join the conversation.