hi,
here is the situation:
There are user profile of type 'brand' and 'store'. Each store may or may not be linked to a 'brand'. The stores of a brand have a common value of a CB field cb_brand. Now I want to setup the brand profile such that when a user of brand profile posts an update, it gets registered with the profilebook and activity plugins of the stores associated with that brand and gets displayed as their brand/activity. For that purpose i create two fields cb_brandupdate and cb_brandupdatetitle for use as the description and title fields of profilebook updates. They are accessible only to brand profile owners during profile update. Now, I am running a code auto action as:
accesslevel:Brands
trigger:onAfterUserUpdate
method:php(eval)
return:silent.
The code is following:
$now = date("Y-m-d H:i:s");
$result = mysql_query("SELECT user_id FROM joomla_comprofiler WHERE cb_brand=[cb_brand]");
while($row = mysql_fetch_array($result))
{
mysql_query("INSERT INTO `backup5aug`.`joomla_comprofiler_plug_profilebook` (`id`, `mode`, `posterid`, `posterip`, `postername`, `posteremail`, `posterlocation`, `posterurl`, `postervote`, `postertitle`, `postercomment`, `date`, `userid`, `feedback`, `editdate`, `editedbyid`, `editedbyname`, `published`, `status`) VALUES (NULL, 'b', '[user_id]', '[user_ip]', '[cb_shopname]', '[email]', NULL, NULL, NULL, '[cb_brandupdatetitle]', '[cb_brandupdate]', '$now', '$result', NULL, NULL, '0', NULL, '1', '1')");
$itemid = mysql_query("SELECT id FROM joomla_comprofiler_plug_profilebook ORDER BY id DESC LIMIT 1");
mysql_query("INSERT INTO `backup5aug`.`joomla_comprofiler_plugin_activity` (`id`, `user_id`, `user`, `type`, `subtype`, `item`, `from`, `to`, `title`, `message`, `icon`, `class`, `date`) VALUES (NULL, '$row', NULL, 'profilebook', 'blog', '$itemid', NULL, NULL, 'posted a new update', NULL, 'font', NULL, '$now')");
}
But it is not working. Is it setup in the right way? Is there another way to achieve this?
Thnx