I imported a dump of the database to my local computer and have
figured out where user information is stored. In case your curious, it
looks like everything we need for population of the array in
truefan_badge.php is here:
> select uid,name from users;
We can include the role (I think that corresponds to the donation
level.) like so:
> select users_roles.uid,name,rid from users inner join users_roles on users.uid=users_roles.uid;
My next step is to call this within Drupal, potentially using the
Drupal 7's object-oriented database API.
http://www.lullabot.com/articles/simplify-your-code-with-drupal-7s-database-api
Tom
thanks for the update. Yes, we will need to get the Ids and Names but
only of the Drupal users with the role "True Fan". You have the
database, when you have a working example, can you share it?
Best would be to implement it in:
http://microfundingtest.openfarmtech.org/mywebsite.php
Short update on the other work:
- Edu is working still on the Share and Invited Page
Nick, what happened with the Recognition Page?
Greetings,
Nikolay
--
Nikolay Georgiev
Open Source Ecology Supporter
Website: http://www.nikolay-georgiev.net/blog/
Skype: nikolay.h.georgiev
Facebook: http://www.facebook.com/nikolayhg
Address: Darmstadt, Germany
In doing this, I came to think that the DRUPAL_ROOT setting is
incorrectly configured. Maybe someone could look into that?
You can see it working here
http://microfundingtest.openfarmtech.org/mywebsite.php
I only changed one number in mywebsite.php; did you intend for me to do more?
Tom
And I actually didn't change mywebsite.php at all.
the code looks good.
1) Can we show the first and last name of the person (including the
checks if some of it is missing)?
2) When you are ready with the role, can you make it in such a way, that:
- When an Id is requested which is not of a True Fan, then an HTML is
returned with the text "Become a True Fan" linking to
http://opensourceecology.org/join.php (later we can adjust the HTML).
3) When everything is ready, can you optimize the performance of the
Javascript call, by saving all data in 1 CSV file which is generated by
a PHP script (cron job runned every 1-2 minutes)? And then mywebsite.php
will read the data from the CSV.
Thank you for the progress!
Nikolay
2) The selection by roles is ready.
3) I never saw the point of putting this all in a client-side script
layer, and I think it'll be easier and faster not to use one. So,
instead, instead, I adjusted the embed code such that no Javascript is
needed. You can compare the methods here.
http://microfundingtest.openfarmtech.org/mywebsite.php?id=4
I'll do 2 (without Javascript) later.
Tom
On Fri, Sep 2, 2011 at 4:16 PM, Nikolay Georgiev
On 09/02/2011 10:47 PM, Thomas Levine wrote:
> 1) I don't remember seeing the last name anywhere in the database. I
> guess I'm using the username rather than the firstname and lastname.
> I'll look for those later.
>
> 2) The selection by roles is ready.
>
> 3) I never saw the point of putting this all in a client-side script
> layer, and I think it'll be easier and faster not to use one. So,
> instead, instead, I adjusted the embed code such that no Javascript is
> needed. You can compare the methods here.
> http://microfundingtest.openfarmtech.org/mywebsite.php?id=4
Javascript is a standard approach due to few reasons:
a) changing the html on the server side structure will not change the
client code! (The user does not have to take care of changes, our server
does)
b) the user can manipulate the html harder if it comes from Javascript
than if it comes as a plain text. (a bit more secure)
Vimeo and Youtube use even iframe, which are maybe more secure than
Javascript, but we can leave this option for now.
Are the reasons understandable?
Nikolay
<div id="badge"></div> <script src="badge.js"></script> <script>ose_badge(3);</script>
Joe: It's actually way simpler than that right now, and my current
approach might not scale well. (I'm not doing much more than I'm told
to because I'm not really clear about what we're looking for.)
On security: I'm still puzzled as to what the security issue beyond
the ability to fake a badge. Maybe I don't know enough about what is
going into the badges.
If there are mockups or plans for the badges, could someone add them
to the wiki page?
http://opensourceecology.org/wiki/OSE_Microfunding_Proposal
<script type="text/javascript" src="badge.js"></script>
<script type="text/javascript" >ose_badge(3);</script>
We'd have to generate badge.js dynamically (we can cache it of
course). My approach allows us to put badge.js on a cdn.
I just realized that you had wanted me to write a php script that
would generate the javascript from a csv rather than a javascript
script that would generate the html from a csv. Oops.
I also figured out that the CiviCRM stuff is in a different database
from the drupal stuff, which is why I couldn't find the first and last
names. My inclination modify my bash script accordingly, but I should
do all of this in PHP with the CiviCRM API. (In case you're confused
as to how it took me so long to realize this: I haven't used CiviCRM
before.)