Kunena 7.0.4 Released

The Kunena team has announce the arrival of Kunena 7.0.4 [K 7.0.4] in stable which is now available for download as a native Joomla extension for J! 5.4.x/6.0.x. This version addresses most of the issues that were discovered in K 6.2 / K 6.3 / K 6.4 and issues discovered during the last development stages of K 7.0

Question [SOLVED] How to add security to the Birthdate for guests?

More
14 years 10 months ago - 14 years 10 months ago #96701 by Cordel
Thank you every one for your input!
Here is what I came up with:

administrator/components/com_kunena/libraries/user.php
Code:
public function profileIcon($name) { $kunena_config = KunenaFactory::getConfig (); //Added This line and next $isRegistered = KunenaFactory::getUser()->exists(); switch ($name) { case 'gender' : switch ($this->gender) { case 1 : $gender = 'male'; break; case 2 : $gender = 'female'; break; default : $gender = 'unknown'; } $title = JText::_ ( 'COM_KUNENA_MYPROFILE_GENDER' ) . ': ' . JText::_ ( 'COM_KUNENA_MYPROFILE_GENDER_' . $gender ); return '<span class="kicon-profile kicon-profile-gender-' . $gender . '" title="' . $title . '"></span>'; break; case 'birthdate' : if ($this->birthdate && ($isRegistered || $kunena_config->pubprofile != 0)) { //Added member condition so not public unless profile is set to public in Kunena config jimport('joomla.utilities.date'); $date = new JDate ( $this->birthdate, 0 ); if ($date->toFormat('%Y')<1902) break; return '<span class="kicon-profile kicon-profile-birthdate" title="' . JText::_ ( 'COM_KUNENA_MYPROFILE_BIRTHDATE' ) . ': ' . CKunenaTimeformat::showDate ( $this->birthdate, 'date', 'utc', 0 ) . '"></span>'; } break; case 'location' : if ($this->location) return '<span class="kicon-profile kicon-profile-location" title="' . JText::_ ( 'COM_KUNENA_MYPROFILE_LOCATION' ) . ': ' . kunena_htmlspecialchars ( $this->location ) . '"></span>'; break; case 'website' : $url = 'http://' . $this->websiteurl; if (! $this->websitename) $websitename = $this->websiteurl; else $websitename = $this->websitename; if ($this->websiteurl) return '<a href="' . kunena_htmlspecialchars ( $url ) . '" target="_blank"><span class="kicon-profile kicon-profile-website" title="' . JText::_ ( 'COM_KUNENA_MYPROFILE_WEBSITE' ) . ': ' . kunena_htmlspecialchars ( $websitename ) . '"></span></a>'; break; case 'private' : $pms = KunenaFactory::getPrivateMessaging (); return $pms->showIcon ( $this->userid ); break; case 'email' : // TODO: show email return; // '<span class="email" title="'. JText::_('COM_KUNENA_MYPROFILE_EMAIL').'"></span>'; break; case 'profile' : if (! $this->userid) return; return CKunenaLink::GetProfileLink ( $this->userid, '<span class="profile" title="' . JText::_ ( 'COM_KUNENA_VIEW_PROFILE' ) . '"></span>' ); break; } }
This is the entire function. Right after the function call you can see I added a call to get from the database Kunea config and to populate a variable for user status.
Code:
public function profileIcon($name) { $kunena_config = KunenaFactory::getConfig (); //Added This line and next $isRegistered = KunenaFactory::getUser()->exists();
Then added the condition:
Code:
case 'birthdate' : if ($this->birthdate && ($isRegistered || $kunena_config->pubprofile != 0)) { //Added member condition so not public unless profile is public in Kunena config.

I also added the same code to social Icons in case someone wants to make a custom template to include these on the summery profile beside or on top of posts in the attached file.

Thank you all and maybe this helps someone ;)
Last edit: 14 years 10 months ago by Cordel. Reason: Opp's don't upload file as php but txt

Please Log in or Create an account to join the conversation.

Time to create page: 0.424 seconds