Jump to content

Search the Community

Showing results for tags 'jomsocial'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • Welcome to PHP Freaks
    • Announcements
    • Introductions
  • PHP Coding
    • PHP Coding Help
    • Regex Help
    • Third Party Scripts
    • FAQ/Code Snippet Repository
  • SQL / Database
    • MySQL Help
    • PostgreSQL
    • Microsoft SQL - MSSQL
    • Other RDBMS and SQL dialects
  • Client Side
    • HTML Help
    • CSS Help
    • Javascript Help
    • Other
  • Applications and Frameworks
    • Applications
    • Frameworks
    • Other Libraries
  • Web Server Administration
    • PHP Installation and Configuration
    • Linux
    • Apache HTTP Server
    • Microsoft IIS
    • Other Web Server Software
  • Other
    • Application Design
    • Other Programming Languages
    • Editor Help (PhpStorm, VS Code, etc)
    • Website Critique
    • Beta Test Your Stuff!
  • Freelance, Contracts, Employment, etc.
    • Services Offered
    • Job Offerings
  • General Discussion
    • PHPFreaks.com Website Feedback
    • Miscellaneous

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


AIM


MSN


Website URL


ICQ


Yahoo


Jabber


Skype


Location


Interests


Age


Donation Link

Found 1 result

  1. I'm still pretty new at this but I want to learn... I have a GPL plugin (for Joomla 1.6 / JomSocial 2.6) that I would like to use (w/ Joomla 2.5 & JomSocial 2.8 ) but it will need some fixing or updating. It should check for a default avatar and replace it with a random one. It installed but doesn't work. How can I verify it's getting the data it needs? I think one problem might be no file listed in the database is default. It looks like this plugin expects one to be there. The script is only about 100 lines so I hope someone can point out some obvious problems. Thanks for looking and any help you can offer. // no direct access defined('_JEXEC') or die('Restricted access'); jimport( 'joomla.plugin.plugin' ); require_once( JPATH_BASE . DS . 'components' . DS . 'com_community' . DS . 'libraries' . DS . 'core.php'); class plgUserMiniSocialGender extends JPlugin { function plgUserMiniSocialGender(& $subject, $config) { parent::__construct($subject, $config); } //function onLoginUser($user, $options) function onUserLogin($user, $options) { //$juser = $this->getJomSocialUser($user); $juser = CFactory::getUser($userid); //$curavatar = $juser->getAvatar(); $curavatar = $juser->getThumbAvatar(); $gender = $juser->getInfo($this->params->get( 'genderfield' , 'FIELD_GENDER' )); //$gender = $user->getInfo('FIELD_GENDER'); if($this->compareEnd("default.jpg", $curavatar) || $this->compareEnd("user.png", $curavatar) || ($this->contains('minisocialgender_images',$curavatar) && $this->params->get( 'reassign' , '0' ))) { if($gender) { $maleurl = JPATH_SITE . DS . 'plugins' . DS . 'user' . DS . 'minisocialgender' .DS . 'minisocialgender_images' . DS . 'male' . DS; $femaleurl = JPATH_SITE . DS . 'plugins' . DS . 'user' . DS . 'minisocialgender' .DS . 'minisocialgender_images' . DS . 'female' . DS; $usermodel =& CFactory::getModel('user'); if($this->params->get( 'maletype' , 'Male' ) == $gender) { if($this->contains("male", $curavatar)) return; } if($this->params->get( 'femaletype' , 'Female' ) == $gender) { if($this->contains("female", $curavatar)) return; } if($gender == $this->params->get( 'maletype' , 'Male' )) { $files = $this->getDirItems($maleurl); $random = rand ( 0 , (count( $files) - 1)); JFile::copy($maleurl . $files[$random], JPATH_SITE . DS . 'plugins' . DS . 'user' . DS .'minisocialgender' .DS . 'minisocialgender_images' . DS . $juser->id . 'male' . '.png'); JFile::copy($maleurl . 'thumb' . DS .$files[$random], JPATH_SITE . DS . 'plugins' . DS . 'user' . DS . 'minisocialgender' .DS . 'minisocialgender_images' . DS . 'thumb' . $juser->id . 'male' . '.png'); $usermodel->setImage($juser->id, 'plugins' . DS . 'user' . DS . 'minisocialgender' .DS . 'minisocialgender_images' . DS . $juser->id . 'male' . '.png', 'avatar'); $usermodel->setImage($juser->id, 'plugins' . DS . 'user' . DS . 'minisocialgender' .DS . 'minisocialgender_images' . DS . 'thumb' . $juser->id . 'male' . '.png', 'thumb'); } elseif($gender == $this->params->get( 'femaletype' , 'Female' )) { $files = $this->getDirItems($femaleurl); $random= rand ( 0 , (count( $files) - 1) ); JFile::copy($femaleurl . $files[$random], JPATH_SITE . DS . 'plugins' . DS . 'user' . DS . 'minisocialgender' .DS . 'minisocialgender_images' . DS . $juser->id . 'female' . '.png'); JFile::copy($femaleurl . 'thumb' . DS . $files[$random], JPATH_SITE . DS . 'plugins' . DS . 'minisocialgender' .DS . 'user' . DS . 'minisocialgender_images' . DS . 'thumb' . $juser->id . 'female' . '.png'); $usermodel->setImage($juser->id, 'plugins' . DS . 'user' . DS . 'minisocialgender' .DS . 'minisocialgender_images' . DS . $juser->id . 'female' . '.png', 'avatar'); $usermodel->setImage($juser->id, 'plugins' . DS . 'user' . DS . 'minisocialgender' .DS . 'minisocialgender_images' . DS . 'thumb' . $juser->id . 'female' . '.png', 'thumb'); } if($this->params->get( 'warnuser' , 1 )) { JFactory::getApplication()->enqueueMessage( $this->params->get( 'warnmessage' )); } } } } function getDirItems($dir) { $files = array(); if (is_dir($dir)) { if ($dh = opendir($dir)) { while (($file = readdir($dh)) !== false) { if(filetype($dir . $file) == "file") { $files[] = $file; } } closedir($dh); } } return $files; } function compareEnd($end, $fullstring) { $StrLen = strlen($end); $FullStrEnd = substr($fullstring, strlen($fullstring) - $StrLen); return ($end == $FullStrEnd); } function contains($needle, $haystack) { $pos = strpos($haystack,$needle); if($pos) return true; else return false; } //function getJomSocialUser($user) //{ // $user2 =& JFactory::getUser(); // $userid = $user2->id; // return CFactory::getUser($userid); //} }
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.