making username clickable in events manager


I need to make the profile picture of those users who will attend my event to be clickable. you can see this below picture to know what I am talking about.

tes

and this is the URL of the said event.

so how to make the profile picture clickable for attendee list of an event?

the answer is by using this code below

/*
 This custom template will make the username link to buddypress profile page using placeholder #_ATTENDEELIST
Instructions:
1. Create these folders inside your current theme directory plugins/events-manager/placeholders
   eg. wp-content/themes/Your Theme/plugins/events-manager/placeholders
2. Inside the above custom directory, create new php file attendeeslist.php
   eg. wp-content/themes/Your Theme/plugins/events-manager/placeholders/attendeeslist.php
3. edit attendeeslist.php and paste the below snippet
4. use placeholder #_ATTENDEESLIST in your formatting options at Events > Settings > Formatting > Events
 */
<?php /* @var $EM_Event EM_Event */ $people = array(); $EM_Bookings = $EM_Event->get_bookings();
if( count($EM_Bookings->bookings) > 0 ){
        ?>
        
<ul class="event-attendees">
        <?php $guest_bookings = get_option('dbem_bookings_registration_disable'); $guest_booking_user = get_option('dbem_bookings_registration_user'); foreach( $EM_Bookings as $EM_Booking){ if($EM_Booking->booking_status == 1 && !in_array($EM_Booking->get_person()->ID, $people) ){
                        $people[] = $EM_Booking->get_person()->ID;
                        echo '
<li>'.bp_core_get_userlink($EM_Booking->get_person()->ID).'</li>

';
                }elseif($EM_Booking->booking_status == 1 && $guest_bookings && $EM_Booking->get_person()->ID == $guest_booking_user ){  
                        echo '
<li>'.bp_core_get_userlink($EM_Booking->get_person()->ID).'</li>

';
                }
        }
        ?>
        </ul>

        <?php
}

you can see many more custom code for events manager plugin in this link

Advertisements

How to know what day from a date?


I am gonna teach you how to know what day it is based on a certain given date with its month. first, you need to look at below table.

Month Day
January Saturday
February Monday
March Tuesday
April Tuesday
May Sunday
June Wednesday
July Friday
August Monday
September Thursday
October Saturday
November Tuesday
December Thursday

so here’s how it works

For any given month, all the multiples of 7 fall on the same day. I usually have memorized what day that is for the current month and the next few months. So October is a “Saturday month” and November is a “Tuesday month” and December is a “Thursday month”. You only have to memorize a new one every month.

Now when somebody says, “We should get together one Saturday. Say… December 12.” you can snap back with “That’s a Tuesday. Do you mean December 9?” All you have to do is find the nearest multiple of 7 and work from there. So when they ask about December 12, that’s close to December 14 – which must be a Thursday (since December 2016 is a Thursday month).

that’s mean you need to look at the table that I’ve just made you above and use the theory from Lifehacker to find out what day it is based on the given date and month.

let’s say we’re trying to find out what day it is during 17 August which is the independence day in Indonesia. since August is a Monday month then the 14th would be Monday and 17th would be Thursday. Hence Indonesia will have independence day on a Thursday. Pretty useful if you need to know the day of the week in the coming month. but for days that are much more farther then just use google to find out.

Silicon valley


Silicon Valley newest episode of 3 really enlightened me to enormous problems that befall a startup. that is why you should be able to understand the law of the land. Such as reading the terms of service, TOS as it called provide a legal ground when you are getting sued over something. By writing about the aspects of your business and the scope of customer you’d want to achieve then TOS can be a lifesaver when you hit the legal problem. Although in Indonesia, there isn’t really such a things as a legal problem for IT company here since there isn’t that many of it. But by hiring a lawyer and studying the current law then you’ll be able to run stuff smoothly.

There are also many great jokes in silicon valley that will make you understand how to deal with programmers. The programmer doesn’t have feelings, they talk like a robot and don’t socialize that much.

email hosting


when you run a business then it is very important to own a custom domain associated with your company and also have email that has a custom address so as to add business credence and proffesionalism to your marketing. and this is why email hosting comes into play.

there are 2 ways to send email, by using email provider like google apps, zoho mail and others or you can just get a server and install email software like zimbra in the server. although the latter requires you to have a sysadmin that will have to standby 24/7 in managing the email server. because if you don’t monitor the server then you might miss those important email from your client and this can be troublesome.

if you used email hosting from shared IP then there is a higher degree that your email IP address might get blacklisted due to spam. and hence will get blocked when you send the email to your client’s email address. so my advice is to use trusted email hosting like google apps or zoho. I had used both of this service and they are just good. although google apps gives you much more functionalities and ask you to pay first to use it.

no matter what, email is still an important tools in delivering messages across business partners and that’s why you should invest money in using better email hosting.

 

RSS feed error


I created a planet feed then there is something wrong with its RSS feed that prevent me from posting the feed in my twitter account. below is the error

This page contains the following errors:

error on line 357 at column 40: xmlParseEntityRef: no name
Below is a rendering of the page up to the first error.

turns out the cause of the error is because one of the blogs that I aggregated into has a post title with (&) ampersand. now this ampersand symbol would be allright if it was put into a post body but if you put it into a post title then the above error would come up.

it’s a bit silly that a single ampersand could have fail the whole RSS feed in planetplanet. so yeah I hope you will not put ampersand in the title of your blog posting and just put it in the post body instead.

 

using ubuntu


I had to go back to using ubuntu again in my computer desktop as my windows had been acting up. the problem started when my old graphics card died and I had to use the new one and the problem was that this new graphic card that is GT630 has a problem with its driver so when I installed the driver in windows 7 or windows XP, it just won’t work and the display is just worsened and not very smooth. even in windows 7 the screen always shows blue screen of death everytime I installed the drivers.

so yeah, in conclusion I had to let go of everything windows and now use ubuntu and as it turns out ubuntu can handle this graphic cards really well and the display is smooth and stable. I just need to learn all the command line and install necessary software for making my experience with ubuntu a lot better. beside I am also planning to use VPS in the coming days so having ubuntu will smoother the experience in managing a server as I need to adapt in using command line.

 

 

indexes in programming


have you ever wonder why indexes always start at  0 but not at 1 ?

animals = ['bear', 'tiger', 'penguin', 'zebra']
bear = animals[0]
tiger = animals[1]

You take a list of animals, and then you get the first (1st) one using 0?! How does that work? Because of the way math works, Python and other progamming languages starts its lists at 0 rather than 1.

The best way to explain why this is happening is by showing you the difference between how you use numbers and how programmers use numbers.

Imagine you are watching the four animals in our list (['bear', 'tiger', 'penguin', 'zebra']) run in a race. They cross the finish line in the order we have them in this list. The race was really exciting because the animals didn’t eat each other and somehow managed to run a race. Your friend shows up late and wants to know who won. Does your friend say, “Hey, who came in zeroth?” No, he says, “Hey, who came in first?”

This is because the order of the animals is important. You can’t have the second animal without the first (1st) animal, and you can’t have the third without the second. It’s also impossible to have a “zeroth” animal since zero means nothing. How can you have a nothing win a race? It just doesn’t make sense. We call these kinds of numbers “ordinal” numbers, because they indicate an ordering of things.

Programmers, however, can’t think this way because they can pick any element out of a list at any point. To programmers, the list of animals is more like a deck of cards. If they want the tiger, they grab it. If they want the zebra, they can take it too. This need to pull elements out of lists at random means that they need a way to indicate elements consistently by an address, or an “index,” and the best way to do that is to start the indices at 0. Trust me on this: the math is way easier for these kinds of accesses. This kind of number is a “cardinal” number and means you can pick at random, so there needs to be a 0 element.

Remember: ordinal == ordered, 1st; cardinal == cards at random, 0.