Flash Sale for Premium Subscriptions

50% off annual premium licence subscription.

Get 50%off now

Formatting the membership directory

About Support Support Formatting the membership directory

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
  • #5289

    I would like to be able to format the membership directory to change the page heading, increase the font size, and be able to prepare the document for booklet printing. I will be downloading the file and using “pdfbook” (part of the “pdfjam” package on Fedora Linux) to actually generate the booklet.

    So the output is readable after printing, I would like to increase the font to at least 15 pitch and increase the margins to .75 inch or a bit larger.

    Being new to the plugin (and it is an outstanding piece of work!), I hate to go in to modify the source code or database by hand without a bit of instruction.

    In “General Settings” I see the maximum number of entries on a directory page, and where the paper size is set, but there are no further settings I can see. The latest plugin manual does not go into detail. I could find no forum topics which address this question.

    Thank you.


    Upon further investigation, it looks like the formatting may be done in the function “church_admin_formatted_household.” Are you using the html2pdf package to convert the membership directory to PDF?

    Would a custom CSS work for the formatting?

    Again, I am very new to this plugin. We began using it to automate our membership directory, though it looks like we will also use the plugin for attendance and birthday lists.

    My blue-sky wish list would be to generate a LaTeX file to format the directory, which would make it a snap to add the front and back matter the congregation desires. That is a bit specialized, however. The next best thing would be to be able to format the membership pages as desired and use various PDF manipulation tools to complete the membership directory.

    Yes, it would be beyond delightful if those who want a membership directory would access it via the smartphone app or via the website, but with an ageing congregation that doesn’t have a lot of people using computers, that is not an option. they want a hard copy.

    Thanks again.

    Avatar for Pastor AndresPastor Andres

    Church Admin uses a FPDF script variant called tFPDF. Andy had to modify it some to bring it up to date but you will be able to find general documentation at fpdf.org and a little information on tFPDF at http://www.fpdf.org/en/script/script92.php

    CSS would be helpful for modifying the layout on screen but nothing more.

    Hope this helps.


    Thank you.

    This looks like it will help.

    I don’t want to modify the basic source code for the plug-in, but I believe an extension might be in order.

    Avatar for Andy MoyleAndy Moyle

    There are few different versions of the PDF the shortcode can produce. You can use PDF=1 or PDF=2 – PDF=1 is the default and the only one being maintained. You can also modify the title with title=”My new title”

    The nice thing about PDF is that when opened they look the same on anything (unlike Word docs which drive me scatty!) So the tFPDF code is about precise positioning of everything (but you have to take account of differing line lengths etc). The functions to use it are detailed at fpdf.org
    In pdf_creator.php there is a function called church_admin_address_pdf_family_photos() which outputs the default PDF. Always happy to add in a new PDF directory style, so you can use that as a basis and then send me over the new function to add in properly.
    Unfortunately it’s not the cleanest code, but it will give you an idea of how to do it. (Will tidy it one day)
    I would create a data array and then cycle through to output which would make more reproducible coding. Live and learn – some of the plugin is 10 year old!!!

    I use tFPDF because it produces unicode PDF which is important for handle accents and diacritics.

    I will rename the address list pdf functions by PDF version number soon, to make things easier!!!



    So I will work on producing a new directory style using the code in pdf_creator.php as a guideline.

    Things I hope to accomplish:
    1. Increase the margins
    2. Not worry about a photo — we are not doing a photo directory, so that should speed things up.
    3. Differentiate between “Member,” “Non-member,” confirmed children, and baptized children.
    4. Put the street address on a separate line from city, state, and zip.
    5. Increase the font size for printing as a booklet — however we may decide to print in portrait so we still need a wider left margin.
    6. Change the title (although the call the the function seems to do that).

    Are there any other things which I should tackle?

    Thank you.



    I am working on increasing the page margins to allow for binding the printed directory. The fpdf manual speaks of the “SetMargins” directive, which works except for the first line of a new page. I believe it may be a problem in fpdf.

    Have you run into this with other modules, and if so, what was the work-around?



    Rejoice with me. I have made the changes to the pdf_creator.php code to meet our formatting requests. Not knowing a better way of giving the changes, I have included them below this message (the complete 256 lines of source code, minus blank lines, to put the changes in context). Thank you, most kind people, for your help and encouragement. Open Source is great, and this is just an example of why it is so important.


    * Address PDF
    * @author Andy Moyle
    * @param $member_type_id
    * @return
    * @version 0.1
    function church_admin_address_pdf_v1($member_type_id=0,$loggedin=1,$showDOB=TRUE,$title=NULL)
    if(defined(‘CA_DEBUG’))church_admin_debug(“*************\r\n PDF v1”);
    if(!empty($loggedin)&&!is_user_logged_in())exit(__(‘You must be logged in to view the PDF’,’church-admin’));
    //initilaise pdf
    class PDF extends FPDF

    function Header()
    if(empty($title))$title=get_option(‘blogname’).’ ‘.__(‘Family Listing’,’church-admin’).’ ‘.date(get_option(‘date_format’));
    function Footer() {
    $footerYLocation = $this->GetPageHeight() -10;
    $footer=__(‘Page: ‘,’church-admin’).$this->PageNo();
    $pdf = new PDF();
    // Add a Unicode font (uses UTF-8)


    // added 1/28/2021 — jbw
    $pdf->SetMargins(25, 25);


    global $wpdb;
    //address book cache
    foreach($memb AS $key=>$value){if(ctype_digit($value)) $membsql[]=’a.member_type_id=’.$value;}
    if(!empty($membsql)) {$memb_sql=’ AND (‘.implode(‘ || ‘,$membsql).’)’;}
    // $sql=’SELECT DISTINCT a.household_id,a.*,b.privacy,b.attachment_id AS household_image FROM ‘.CA_PEO_TBL.’ a LEFT JOIN ‘.CA_HOU_TBL.’ b on a.household_id=b.household_id WHERE (b.privacy=0 OR b.privacy iS NULL) AND a.head_of_household=1 ‘.$memb_sql.’ ORDER BY a.last_name,a.first_name,a.middle_name ASC’;
    // added 1/28/2021 — jbw per Andy Moyes
    $sql=’SELECT DISTINCT a.household_id,a.*,b.privacy,b.attachment_id AS household_image FROM ‘.CA_PEO_TBL.’ a LEFT JOIN ‘.CA_HOU_TBL.’ b on a.household_id=b.household_id WHERE (b.privacy=0 OR b.privacy iS NULL) AND a.head_of_household=1 ‘.$memb_sql.’ ORDER BY a.last_name,a.first_name,a.middle_name ASC’;
    $imageTopLeft=$pageWidth-75;//50mm wide and 10mm margin from edge and 5mm from box edge
    foreach($results AS $ordered_row)
    $outputlines = 0;
    $address=$wpdb->get_row(‘SELECT * FROM ‘.CA_HOU_TBL.’ WHERE household_id=”‘.esc_sql($ordered_row->household_id).'”‘);
    $people_results=$wpdb->get_results(‘SELECT * FROM ‘.CA_PEO_TBL.’ WHERE household_id=”‘.esc_sql($ordered_row->household_id).'” ORDER BY people_type_id ASC,sex DESC’);
    $image=church_admin_scaled_image_path($ordered_row->household_image,’medium’) ;

    // added 1/28/2021 — jbw
    $pdf->SetMargins(25, 25);

    // changed 2/5/2021 — jbw
    // $pdf->SetXY(10,20);
    //output image on right hand side
    foreach($people_results AS $people)
    $prefix=$people->prefix.’ ‘;
    if(!empty($people->email)&&$people->email!=end($emails)) $emails[$people->first_name]=$people->email;
    if(!empty($people->date_of_birth)&&$people->date_of_birth!=end($date_of_birth) && $people->date_of_birth != ‘0000-00-00’)

    //create output
    // changed 2-5-2021 — jbw
    // foreach($adults as $lastname=>$firstnames){$adultline[]=implode(” & “,$firstnames).’ ‘.$lastname;}
    foreach($adults as $lastname=>$firstnames){$adultline[]=”$lastname, “.implode(” & “,$firstnames);}
    //address name of adults in household

    $pdf->Cell(0,5,implode(” & “,$adultline),0,1,’L’);
    $outputlines += 1;

    $pdf->Cell(0,5,implode(“, “,$children),0,1,’L’);
    $outputlines += 1;
    //address if stored

    $outputlines += 1;

    $pdf->Cell(0,5,__(‘Mailing address: ‘,’church-admin’).$address->mailing_address,0,1,’L’);
    $outputlines += 1;
    if (!empty($emails))
    if(count($emails)<2 && $x<=1)

    $outputlines += 1;
    {//more than one email in household
    foreach($emails AS $name=>$email)
    $content=$name.’: ‘.$email;

    $outputlines += 1;

    if (!empty($address->phone)) {

    $outputlines += 1;
    if (!empty($mobiles)) {

    if(count($mobiles)<2 && $x<=1) {
    $outputlines += 1;
    else {//more than one mobile in household
    foreach($mobiles AS $name=>$mobile) {
    $content=$name.’: ‘.$mobile;
    if($mobile!=end($mobiles))$content.=’, ‘;
    //$outputlines += 1;

    $outputlines += 1;
    //dates of birth
    if (!empty($date_of_birth)&&!empty($showDOB))
    if(count($date_of_birth)<2 && $x<=1)

    $pdf->Cell(0,5,__(‘Date of birth’,’church-admin’).’ ‘.end($date_of_birth),0,1,’L’,FALSE,”);
    $outputlines += 1;
    {//more than one email in household
    foreach($date_of_birth AS $name=>$dob)
    $content=sprintf(__(‘Date of birth for %1$s: %2$s’,’church-admin’),$name,$dob);

    $outputlines += 1;





Viewing 8 posts - 1 through 8 (of 8 total)
  • You must be logged in to reply to this topic.