761
deka87
Re: Notifications based on criteria
  • 2008/12/21 11:07

  • deka87

  • Friend of XOOPS

  • Posts: 1125

  • Since: 2007/10/5


these are queries i got in debug when enabling global notifications in catads for admin (uid =1 ofc):

SELECT FROM U39uxs_config WHERE (conf_modid '1' AND conf_catid '1'ORDER BY conf_order ASC
SELECT sess_data FROM U39uxs_session WHERE sess_id 
'77656ccbf6d1a2961f21accf8e7c7614'
0.023843)
SELECT FROM U39uxs_users uU39uxs_user_profile p WHERE u.uid p.profileid AND uid '1' LIMIT 01
0.004991)
SELECT FROM U39uxs_modules WHERE dirname 'catads'
0.000412)
SELECT FROM U39uxs_config WHERE (conf_modid '91'ORDER BY conf_order ASC
0.000458)
SELECT FROM U39uxs_config WHERE (conf_modid '1' AND conf_catid '3'ORDER BY conf_order ASC
0.000414)
SELECT FROM U39uxs_group_permission WHERE (gperm_modid '1' AND gperm_name 'module_admin' AND gperm_groupid IN (1,2))
0.00031)
SELECT FROM U39uxs_modules WHERE (hasadmin '1' AND isactive '1' AND mid IN (1,2,23,5,6,9,12,95,94,21,18,57,54,32,33,34,36,91,51,78,79,81,82,85)) ORDER BY name ASC
0.000389)
SELECT FROM U39uxs_group_permission WHERE (gperm_modid '1' AND gperm_name 'system_admin' AND gperm_groupid IN (1,2))
0.000457)
SELECT FROM U39uxs_configcategory WHERE confcat_modid IN (57,5,21,85,78,91,36,12,82,18,32,81,1,51,6,34,79,9,23,33,54)
0.000405)
SELECT FROM U39uxs_modules WHERE dirname 'glossaries'
0.000412)
SELECT FROM U39uxs_config WHERE (conf_modid '85'ORDER BY conf_order ASC
0.000466)
SELECT categoryIDname FROM U39uxs_lxcategories02
0.000432)
SELECT FROM U39uxs_modules WHERE dirname 'lexikon'
0.000398)
SELECT FROM U39uxs_config WHERE (conf_modid '78'ORDER BY conf_order ASC
0.000415)
SELECT categoryIDname FROM U39uxs_lxcategories
0.000405)
SELECT COUNT(*) FROM U39uxs_catads_ads WHERE uid '1'
0.000298)
SELECT groupidname FROM U39uxs_groups ORDER BY name ASC
0.000406)
SELECT FROM U39uxs_modules WHERE dirname 'news'
Queries core
SELECT 
FROM U39uxs_config WHERE (conf_modid '1' AND conf_catid '1'ORDER BY conf_order ASC
SELECT sess_data FROM U39uxs_session WHERE sess_id 
'77656ccbf6d1a2961f21accf8e7c7614'
0.000476)
SELECT FROM U39uxs_users uU39uxs_user_profile p WHERE u.uid p.profileid AND uid '1' LIMIT 01
0.000534)
SELECT FROM U39uxs_modules WHERE dirname 'catads'
0.00036)
SELECT FROM U39uxs_config WHERE (conf_modid '91'ORDER BY conf_order ASC
0.000457)
SELECT FROM U39uxs_config WHERE (conf_modid '1' AND conf_catid '3'ORDER BY conf_order ASC
0.000319)
SELECT COUNT(*) FROM U39uxs_catads_ads WHERE uid '1'
0.000225)
SELECT FROM U39uxs_group_permission WHERE (gperm_modid '1' AND gperm_name 'block_read' AND gperm_groupid IN (1,2))
0.00032)
SELECT DISTINCT i.instanceidb.*, i.* FROM U39uxs_block_instance iU39uxs_newblocks bU39uxs_block_module_link m WHERE m.block_id=i.instanceid AND i.instanceid IN (17,58,42,127,54,87,134,100,84,85,111,106,113,129,128,115,126,118,122) AND i.visible=AND i.bid=b.bid AND b.isactive=AND ( (m.module_id=AND m.pageid=0) OR (m.module_id=91 AND m.pageid IN (0,0)) ) ORDER BY i.weight,i.instanceid
0.000432)
SELECT FROM U39uxs_xoopsnotifications WHERE (not_modid '91' AND not_category 'global' AND not_uid '1')
0.00061)
SELECT FROM U39uxs_modules WHERE mid 91
0.000319)
SELECT COUNT(*) FROM U39uxs_catads_ads WHERE uid '1'
0.000179)
SELECT FROM U39uxs_modules WHERE dirname 'xbs_tags'
0.000501)
SELECT FROM U39uxs_config WHERE (conf_modid '33'ORDER BY conf_order ASC
0.000411)
select id from U39uxs_tags_index where tags_fname '/modules/catads/index.php'
0.000298)
select from U39uxs_tags_index where id 4
0.000353)
SELECT FROM U39uxs_modules WHERE mid 7
0.000346)
Total Number of Queries17  |  Total SQL Generation Time0.00614

Queries module
DELETE FROM U39uxs_protector_access WHERE expire 
UNIX_TIMESTAMP()
0.000308)
SELECT COUNT(*) FROM U39uxs_protector_access WHERE ip='88.147.214.245' AND request_uri='/modules/catads/index.php'
0.00038)
SELECT COUNT(*) FROM U39uxs_protector_access WHERE ip='88.147.214.245'
0.000273)
INSERT INTO U39uxs_protector_access SET ip='88.147.214.245',request_uri='/modules/catads/index.php',expire=UNIX_TIMESTAMP()+'60'
0.000398)
SELECT COUNT(*) FROM U39uxs_catads_ads WHERE waiting '1'
0.000203)
SELECT cat_idcount(*) FROM U39uxs_catads_ads WHERE (waiting '0' AND published '1229857231' AND expired '1229857231'GROUP BY cat_id
0.000659)
SELECT cat_idcount(*) FROM U39uxs_catads_ads WHERE (published '1229598031' AND waiting '0' AND expired '1229857231' AND published '1229857231'GROUP BY cat_id
0.000429)
SELECT FROM U39uxs_catads_cat ORDER BY weight
0.000272)
SELECT cat_idpid FROM U39uxs_catads_cat
0.000238)
SELECT cat_idtitleimg FROM U39uxs_catads_cat WHERE pid 0 ORDER BY weight
0.000301)
SELECT FROM U39uxs_catads_cat WHERE pid =1 ORDER BY weight
0.000229)
SELECT FROM U39uxs_catads_cat WHERE pid =2 ORDER BY weight
0.000254)
SELECT FROM U39uxs_catads_cat WHERE pid =3 ORDER BY weight
0.000262)
SELECT COUNT(*) FROM U39uxs_catads_ads WHERE (waiting '0' AND published '1229857231' AND expired '1229857231')
0.000411)
SELECT FROM U39uxs_catads_ads WHERE (waiting '0' AND published '1229857231' AND expired '1229857231'ORDER BY published DESC LIMIT 010
0.000834)
Total Number of Queries15  |  Total SQL Generation Time0.00545

Queries block
SELECT 
FROM U39uxs_modules WHERE dirname 'pm'
0.000307)
SELECT COUNT(*) FROM U39uxs_priv_msgs WHERE (read_msg '0' AND to_userid '1')
0.00025)
SELECT FROM U39uxs_smiles
0.000442)
SELECT cat_idtitle FROM U39uxs_catads_cat WHERE pid=0 ORDER BY title
0.000331)
SELECT FROM U39uxs_catads_cat WHERE pid=2 ORDER BY title
0.000349)
SELECT FROM U39uxs_catads_cat WHERE pid=3 ORDER BY title
0.000335)
SELECT FROM U39uxs_catads_cat WHERE pid=1 ORDER BY title
0.000364)


Im not sure how to see what queries are used in debug for table xoopsnotifications tho.
Mind anchors



762
deka87
Re: Notifications based on criteria
  • 2008/12/21 10:33

  • deka87

  • Friend of XOOPS

  • Posts: 1125

  • Since: 2007/10/5


OK, my report starting from the 4th step:

4. Notification is received
5. Done
6. Notification is still received.
7. Done
8. Unable to reach adsmode.php only get a blank page.

So whenever I add sql I get a blank page =(
Mind anchors



763
deka87
Re: how to make Horizontal news block ?
  • 2008/12/20 20:10

  • deka87

  • Friend of XOOPS

  • Posts: 1125

  • Since: 2007/10/5


go to www.yourwebsite.com/admin.php - templates. clone your default template set. then go to system preferences and set your cloned template set as a default for your website. then go back to www.yourwebsite.com/admin.php - templates and find your news module, click it scroll down to the end of the page and find a template for the block you want to edit (like latest_news.html) click edit, copy and paste the code in any WYSIWYG editor like dreamweaver and save. i believe that this is gonna be it.
Mind anchors



764
deka87
Re: how to make Horizontal news block ?
  • 2008/12/20 16:00

  • deka87

  • Friend of XOOPS

  • Posts: 1125

  • Since: 2007/10/5


simply install the news module and edit the template for the block you need.
Mind anchors



765
deka87
Re: Notifications based on criteria
  • 2008/12/20 15:10

  • deka87

  • Friend of XOOPS

  • Posts: 1125

  • Since: 2007/10/5


that's what i found in the adsmod.php

// Notification
        
$notification_handler =& xoops_gethandler('notification');
        
$tags = array();
        
$tags['ADS_TITLE'] = $ads->getVar('ads_title');
        
$tags['ADS_LANG'] = $ads->getVar('ads_lang1').' to '.$ads->getVar('ads_lang2');
        
$tags['ADS_DESC'] = $ads->getVar('ads_desc');
        
$tags['ADS_URL'] = XOOPS_URL '/modules/' $xoopsModule->getVar('dirname') . '/adsitem.php?ads_id=' $ads_id;

        
$notification_handler->triggerEvent('global'0'new_ads'$tags);
        
$notification_handler->triggerEvent('category'$cat_id'new_ads'$tags);
        
$notification_handler->triggerEvent('ads'$ads_id'approve'$tags);
    } else {
        
$messagesent _AM_CATADS_ERROR_UPDATE;
    }
    
redirect_header("index.php?op=show&sel_status=2"1$messagesent);
    exit();
}


I guess this is what we need.

As in regard to the the selections boxes, I thought it might be a good idea, but i have over 700 registered users and it'd be pretty tough to make them choose it again, there are over 100 languages in my database so I will need to make a dropdown to choose from. But dropdowns are not searchable in my profile/search.php which is needed for another section of my website.

So I gave it a shot and edited adsmod.php like this:

// Notification
        
$notification_handler =& xoops_gethandler('notification');
        
$tags = array();
        
$tags['ADS_TITLE'] = $ads->getVar('ads_title');
        
$tags['ADS_LANG'] = $ads->getVar('ads_lang1').' to '.$ads->getVar('ads_lang2');
        
$tags['ADS_DESC'] = $ads->getVar('ads_desc');
        
$tags['ADS_URL'] = XOOPS_URL '/modules/' $xoopsModule->getVar('dirname') . '/adsitem.php?ads_id=' $ads_id;

        
$sql '
SELECT * FROM '
.$this->db->prefix('xoopsnotifications').
LEFT JOIN '
.$this->db->prefix('user_profile').
 ON not_uid = profileid 
WHERE
 not_modid = '
.$mod_id.' AND
 not_itemid = '
.0.' AND
 not_category = '
."'global'".' AND
 not_event = '
."'new_ads'".' AND
 ((source_language <> '
.$ads->getVar('ads_lang1').') OR
  (target_language <> '
.$ads->getVar('ads_lang2').'))';

$result $xoopsDB->query($sql);
$user_list = array();
while(
$row $xoopsDB->fetchArray($result)){
   
$user_list[] = $row['not_uid'];
}

$notification_handler->triggerEvent('global'0'new_ads'$tags$user_list);
        
$notification_handler->triggerEvent('category'$cat_id'new_ads'$tags);
        
$notification_handler->triggerEvent('ads'$ads_id'approve'$tags);
    } else {
        
$messagesent _AM_CATADS_ERROR_UPDATE;
    }
    
redirect_header("index.php?op=show&sel_status=2"1$messagesent);
    exit();
}


but got a blank page again
Mind anchors



766
deka87
Re: Notifications based on criteria
  • 2008/12/20 12:19

  • deka87

  • Friend of XOOPS

  • Posts: 1125

  • Since: 2007/10/5


OK, my report starting from the 4th step:

4. Notification is received
5. Done
6. Notification is still received.
7. Done
8. Unable to reach catads/submit1.php only get a blank page.

As in regard to the 6th step, just a suggestion: all the ads before publishing have to be approved by the administrator, so I click the "publish" link onhttp://freelancersupport.com/modules/catads/admin/index.php. The publish link url ishttp://freelancersupport.com/modules/catads/admin/adsmod.php?op=approve&ads_id=13. Maybe we need to edit some other script?

Mind anchors



767
deka87
Re: Notifications based on criteria
  • 2008/12/20 8:07

  • deka87

  • Friend of XOOPS

  • Posts: 1125

  • Since: 2007/10/5


I gave the code a try and replaced the original

$notification_handler->triggerEvent('global'0'ads_submit'$tags);


with the code you provided:

$sql '
SELECT * FROM '
.$this->db->prefix('xoopsnotifications').
LEFT JOIN '
.$this->db->prefix('user_profile').
 ON not_uid = profileid 
WHERE
 not_modid = '
.$mod_id.' AND
 not_itemid = '
.0.' AND
 not_category = '
."'global'".' AND
 not_event = '
."'ads_submit'".' AND
 ((source_language <> '
.$ads->getVar('ads_lang1').') OR
  (target_language <> '
.$ads->getVar('ads_lang2').'))';

$result $xoopsDB->query($sql);
$user_list = array();
while(
$row $xoopsDB->fetchArray($result)){
   
$user_list[] = $row['not_uid'];
}

$notification_handler->triggerEvent('global'0'ads_submit'$tags$user_list);



but unfortunately this caused a blank page.

I am trying to match $source_language from the registration form with $ads_lang1 from the catads module AND $target_language from the registration form and $ads_lang2 from the catads module. So a user has got to be notified (if he subscribed to notifications ofc) when a new ad is posted matching his criteria i.e. when ad's $ads_lang1 = his $source_language AND ad's $ads_lang2 = his $target_language. I gave up the idea with the coutry so what I have mentioned above is what I focus on.

You may want to take a look here:

Here is a registration form:http://freelancersupport.com/modules/profile/register.php which contains $source_language and $target_language (under Source language and Target language titles)

and the ad posting form:http://freelancersupport.com/modules/catads/submit1.php?cat_id=1

which contains $ads_lang1 (which is Source language in the ads submission form) and $ads_lang2 (which is Target language in the ads submission form).
Mind anchors



768
deka87
Re: Notifications based on criteria
  • 2008/12/19 22:07

  • deka87

  • Friend of XOOPS

  • Posts: 1125

  • Since: 2007/10/5


those variables were added in the profile module. the piece of code i submitted the first time is taken from catads/submit1.php so it doesn't contain those variable.
Mind anchors



769
deka87
Re: Database error
  • 2008/12/19 15:49

  • deka87

  • Friend of XOOPS

  • Posts: 1125

  • Since: 2007/10/5


Did you try to upload the same smartsection version as you had before and simply import that part of your database backup that contain smartsection tables?
Mind anchors



770
deka87
Re: Notifications based on criteria
  • 2008/12/19 14:53

  • deka87

  • Friend of XOOPS

  • Posts: 1125

  • Since: 2007/10/5


i really suck in php, so sorry for my silly questions a priori.

so is this supposed to be like this:

$xoopsDB->query($sql)

$sql '
SELECT * FROM '
.$this->db->prefix('xoopsnotifications').
LEFT JOIN '
.$this->db->prefix('user_profile').
 ON not_uid = profileid 
WHERE
 not_modid = '
.$mod_id.' AND
 not_itemid = '
.0.' AND
 not_category = '
."'global'".' AND
 not_event = '
."'ads_submit'".' AND
 ((source_language <> '
.$ads->getVar('ads_lang1').') OR
  (target_language <> '
.$ads->getVar('ads_lang2').'))';

$user_list = array('1','23','134');//do this your way
$notification_handler->triggerEvent('global'0'ads_submit'$tags$user_list);


or i'm missing soemthing again..
Mind anchors




TopTop
« 1 ... 74 75 76 (77) 78 79 80 ... 96 »



Login

Who's Online

158 user(s) are online (112 user(s) are browsing Support Forums)


Members: 0


Guests: 158


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